javascript - Position an element in the middle of header -
how can make work in firefox? want p
element positioned vertically in middle of header
.
header
need stay absolute positioned
html
<header> <p>text text text text text text text</p> </header>
css
header { color: #3b4043; font-family: 'source_sans_prolight',sans-serif; font-size: 36px; height: 234px; left: 0; margin: 0 auto; position: absolute; right: 0; text-align: center; text-transform: uppercase; top: 0; width: 100%; background: green; } header p { bottom: 0; display: inline-table; left: 0; margin: auto; position: absolute; right: 0; top: 0; width: 100%; }
use vertical-align
center , delete position of p
tag , problem solved !
demo : jsfiddle
try css code here :
header { color: #3b4043; font-family: 'source_sans_prolight',sans-serif; font-size: 36px; height: 234px; left: 0; margin: 0 auto; position: absolute; right: 0; text-align: center; text-transform: uppercase; top: 0; width: 100%; background: green; display:table; } header p { bottom: 0; display:table-cell; vertical-align:middle; left: 0; margin: auto; right: 0; width: 100%; }
Comments
Post a Comment