I am trying to find the most effective way to align text with a div. I have tried a few things and none seem to work.
.testimonialText {
position: absolute;
left: 15px;
top: 15px;
width: 150px;
height: 309px;
vertical-align: middle;
text-align: center;
font-family: Georgia, "Times New Roman", Times, serif;
font-style: italic;
padding: 1em 0 1em 0;
}
<div class="testimonialText">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
HTML
CSS
There's a simpler way to vertically align the content without resorting to table/table-cell:
http://jsfiddle.net/bBW5w/1/
In it I have added an invisible (width=0) div that assumes the entire height of the container.
It seems to work in IE and FF (latest versions), didn't check with other browsers
And of course the CSS:
Simple solution to an element of not knowing values
HTML
CSS
According to Adam Tomat's answer there was prepared a jsfiddle example to align the text in div
by use display:flex in CSS
with another example and few explanation in blog.