Maintain aspect ratio with a fixed height
问题 So I want to maintain a specific aspect ratio of a div , where the height is fixed. In the past I have done this, but only when using a fixed width like this: .one-one { position: relative; } .one-one:before { display: block; content: " "; width: 100%; padding-top: 56.25%; /* Ratio of 16:9 (16w:9h) * (h / w) * 100 = % * (9 / 16) * 100 = % * 0.5625 * 100 = 56.25% * 1:1 = 100% */ } So that's how I would do it using a fixed width of 100% in this example. However, this time I want to make an