Vertically align text in a div

This is loosely taken from this page:

Here is the html structure:

<div class="container">
	<p>
		Your content here.
	</p>
</div>

Here’s the css:
Must have a height, be set to be a table and have the vertical-align set.

.container { height:75px; display: table; vertical-align:middle; }
.container p { display:table-cell; vertical-align: middle; }

Revisions

Tags: ,

No comments yet.

Leave a Reply