Margin Auto Goes To Negative Values
I have problem with margin: auto - vertical centering #something { width: 97%; height: 300px; border: 1px solid red; position: absolute; top: 0; bottom: 0;
Solution 1:
From what I gather, you're wanting the top of the divider to display at the top of the page. This currently isn't happening because you have the position set to top:0; bottom:0;
, the top
property is conflicted by the bottom
property, ultimately positions the divider to the bottom of the page. Simply removing the bottom
property prevents the top of the element appearing outside of the viewport:
#something {
width: 97%;
height: 300px;
border: 1px solid red;
position: absolute;
top: 0;
margin: auto;
}
Solution 2:
I removed the problem in browsers, when i use position: relative
to the body element. Now its working in firefox and in other browser too. Live example on http://dev8.newlogic.cz
Post a Comment for "Margin Auto Goes To Negative Values"