How to do it in html or css, so that the text in the block is centered, vertically and horizontally.

    2 answers 2

    http://jsfiddle.net/ck2xn/

    <div> <p>Some text</p> </div> div { width: 300px; height: 300px; border: 1px solid; display: table; } p { text-align: center; display: table-cell; vertical-align: middle; } 
    • this is the right solution) - mountpoint

    http://jsfiddle.net/j4Ryu/ horizontally, but probably not vertically by these means, unless margin-top