Css set height proportional to width
It therefore reduces to height zero, and it (and it's background) are no longer seen. One way to fix it is to add another div, inside your parent container but after the inner-left and inner-right divs, and in the css give it the property clear:both:- Fluid Ratio with Max Width/Height and Viewport Units. To make a proportional container that scales responsively based on the viewport size, the padding hack were introduced. Now, we can mimic the same behaviour by combining viewport units and max width/height in CSS. Based on an article by Miriam Suzanne, I want to explain how it works. Feb 29, 2012 · Other elements have their display value set to inline by default. This means they don’t have a definable height and width and will not create new rows in a layout (thus they appear “inline”). Inline elements are generally the type of thing that you institute within a paragraph or other block-level element: strong, em, anchor, etc.
Aug 10, 2013 · In the normal content flow, margin: auto; equals ‘0’ for the top and bottom. W3.org: If ‘margin-top’, or ‘margin-bottom’ are ‘auto’, their used value is 0. position: absolute; breaks the block out of the typical content flow, rendering the rest of the content as if that block weren’t there.