How can I vertically centre text in a div of known height, but without setting the line-height attribute as the text may span more than one line?

I think the only HTML that can automatically adjust text vertically is a table cell, so if you are using a div you can apply a little trick: align-vertically { display: table-cell; vertical-align: middle; } in this way you will change the default display behavior, to make the div acting like a cell!

I think the only HTML that can automatically adjust text vertically is a table cell, so if you are using a div you can apply a little trick: . Align-vertically { display: table-cell; vertical-align: middle; } in this way you will change the default display behavior, to make the div acting like a cell!

Thanks @daveoncode but I actually managed to work it out myself, I didn't need to set the height of the div and therefore didn't require the line-height so I could just use margins and padding. – Mike Aug 28 at 17:53.

I have actually found the answer to what I need myself. . Info, .

Success, . Warning, . Error, .

Validation { border: 1px solid; margin: 10px 0px; padding:15px 10px 15px 50px; } . Info { color: #00529B; background-color: #BDE5F8; } . Success { color: #4F8A10; background-color: #DFF2BF; } .

Warning { color: #9F6000; background-color: #FEEFB3; } . Error { color: #D8000C; background-color: #FFBABA; } The 'trick' so-to-speak is to not set a height for the div and just set padding/margins to do the centring.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions

?
  • Div> What was aristotle objection to the atomic theory?
  • ?
  • Div> Q and Not U?
  • Div> How does hydrostatic pressure relate to blood pressure??
  • Vertically centering a span in a div?
  • Given a block of text, how to vertically center w one line. But grow to support 2 lines of text?

  • » About WebKnox
    » Contact
    » WebKnox Blog
    » RSS
    » Newsletter
    » Twitter
    » API
    » API Showcase