Sam Jones
Sam Jones

Reputation: 43

Vertically Align A Div

Does anyone have reliable markup/ CSS that vertically align a div across all browsers? Can get the following working in Firefox but not others..

.parent { display: table; }
.child { display: table-cell; }  /* this panel is to align vertically in the middle*/

Upvotes: 3

Views: 228

Answers (1)

VictorC
VictorC

Reputation: 326

if you are vertical aligning simple text you can do:

.container { height:300px; line-height:300px }

If you want to vertical aligng a div then you will need to use some javascript in order to make it work in all browsers.

Upvotes: 1

Related Questions