Ryan McFarlane 11, Points. You're actually seeing the top margin of the inner element collapse into the top edge of the outer element, leaving only the outer margin intact albeit not shown in your images. Save my name, email, and website in this browser for the next time I comment. Hope this helps. If fewer than four values are set, the missing values are assumed based on the ones that are defined. You might paste security vulnerabilities, too. Please sign in or sign up to post. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. This will be key when you start using positioning and floats.
You're actually seeing the top margin of the #inner element collapse into the top.
Why the bottom margin does not work Get Started The SitePoint Forums
add several more solutions for this problem. check this w3c_collapsing margin. The bottom margin of an in-flow block-level element always. › questions › css-margin-top-not-working. elements have a default display property of inline.
inline elements are not affected by margins or paddings, amongst other things.
Contact Us. Brandon Brandon More information about margin on mozilla developer network.
Maybe set up a CodePen so we can have a better look at the structure, unfortunately this comment feed isn't the best sometimes for debugging things Second, they allow for a more consistent approach to declaring universal margins across page elements. I guess setting the position property of the inner div to relative may also help achieve the effect. Vertical margins on different elements that touch each other thus have no content, padding, or borders separating them will collapse, forming a single margin that is equal to the greater of the adjoining margins.
Rachel Andrew is not only Editor in Chief of Smashing Magazine, but also a web The margin-top, margin-right, margin-bottom and margin-left properties There is now a Level 3 Box Model specification as a Working Draft.
html Why does this CSS margintop style not work Stack Overflow
With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).
Third, margin collapse also applies to nested elements. Please sign in or sign up to post. Whenever you have an inline element which is followed by a block element or any element rendered in a new linethere will be a vertical space between these two.
If you add any padding to outerit works. We'll publish all comments that are on topic, not rude, and adhere to our Code of Conduct.
Video: Css margin top bottom not working ClickFunnels: How to Adjust Margins On Elements (Using Custom CSS)