Aspect Ratio Boxes in CSS


Create boxes that maintain an aspect ratio, useful for responsive designs.

Source Code

.aspect-ratio-box {
    width: 100%;
    height: 0;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    position: relative;
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments