Is it possible to make a square block auto width in HTML+CSS?

Thank you for paying attention to my question, which is:

Is it possible to make a block (div) with auto width, whose height is always equal to the width ofonly html and css, without javascript?

Thanks for the replies.
September 19th 19 at 12:50
3 answers
September 19th 19 at 12:52
Solution
Tore would be the hands, for the fact that you write the question in italics
<div class="wrapper">
 <div class="box"></div>
</div>

.wrapper {
 width: 100px;
 margin: 0 auto;
}

.box {
 background: goldenrod;
 margin-left: auto;
 margin-right: auto;
 padding-top: 50%;
 padding-bottom: 50%;
}
No need to post the sheets code — there is jsfiddle. - Krista_Heaney9 commented on September 19th 19 at 12:55
What a clan of atributele hands :))) - orval_Heaney95 commented on September 19th 19 at 12:58
d97aa46ab99d40ff851c88a2bdaaa2af.jpg - mauricio.Wolff54 commented on September 19th 19 at 13:01
: why is there so love when there is poor jsfiddle codepen for normal white people? - kenna commented on September 19th 19 at 13:04
: white jsfiddle, codepen is not)) - mauricio.Wolff54 commented on September 19th 19 at 13:07
: the first 5 times when I opened kopen, about the same thought and was afraid of him. But after nearly a year of use in the form of fidl I want to cry and feed him as emaciated, homeless puppy. - kenna commented on September 19th 19 at 13:10
Kogepan full of crap buggy, isfel of candy. - Krista_Heaney9 commented on September 19th 19 at 13:13
: Yes - mauricio.Wolff54 commented on September 19th 19 at 13:16
September 19th 19 at 12:54
Google the expression css padding hack, the theme is as old as the world — this is exactly how to make the height proportional to the width of the block. Here's a sandbox, change the width of the frame, the box will proportionally change its size.
I Express huge gratitude :) just what you need! - Krista_Heaney9 commented on September 19th 19 at 12:57
September 19th 19 at 12:56
Thank you guys for your options. Helped all :) But first, and sneakers :)

Find more questions by tags CSSHTML