L
L
lanvin lanvin072016-04-14 03:51:08
css
lanvin lanvin07, 2016-04-14 03:51:08

The width of the object is tied to the width of the window. How to set height equal to width?

The width of the object is 10% of the width of the window.
How can I set the height of an object to be equal to the width so that the object remains square regardless of the screen aspect ratio of the device?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2016-04-14
@lanvin07

Sandbox example

div {
    width: 10%;
    height: 10vw;
}

L
Lertmind, 2016-04-14
@Lertmind

Perhaps this is the answer www.mademyday.de/css-height-equals-width-with-pure...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question