I want to align some text in the middle of my element using CSS. This is my markup:
<div id="testimonial"> <span class="quote">Some random text that spans two lines</span> </div>
And the corresponding CSS:
#testimonial { background: url('images/testimonial.png') no-repeat; width: 898px; height: 138px; margin: 0 auto; margin-top: 10px; text-align: center; padding: 0px 30px 0px 30px; } .quote { font-size: 32px; font-family: "Times New Roman", Verdanna, Arial, sans-serif; vertical-align: middle; font-style: italic; color: #676767; text-shadow: 1px 1px #e7e7e7; }
Usually, to get .quote in the vertical middle of #testimonial , I would do:
.quote { line-height: 138px; }
But this breaks the layout because the text in .quote spans more than one line.
As you can see, I tried to do vertical-align: middle; , and that doesn't work either.
Any help is appreciated. Greetings.
html css xhtml
Josh May 30 '11 at 19:25 2011-05-30 19:25
source share