### Constant width to height ratio Given an element of variable width, it will ensure its height remains proportionate in a responsive fashion (i.e., its width to height ratio remains constant). #### HTML ```html
``` #### CSS ```css .constant-width-to-height-ratio { background: #333; width: 50%; } .constant-width-to-height-ratio::before { content: ''; padding-top: 100%; float: left; } .constant-width-to-height-ratio::after { content: ''; display: block; clear: both; } ``` #### Demo Resize your browser window to see the proportion of the element remain the same.