ke8x2w
Last Updated: November 02, 2017
·
3.119K
· netzach23
B8a77b0bcbaf3cbd2c04a4af940f0791

CSS responsive square (height: width;)

.suqare {
    width: 50%;
    height: 0;
    padding-bottom: 50%;
}

This will result in a square of 50% height and 50% width.

EDIT:
Unfortunately i didn't found a solution for the other way. (width: height;) If anyone knows a way to do this, pls give me a link or short description. Thank you!

Say Thanks
Respond

1 Response
Add your response

12323
0 ndxxk8mm5tdpwm3 qwjckijuf pkbm8 4swukiy64ah8zobtvf7ho ohdsy7xwtobogvxkus 6hd

I'm using this. However, when there's border the percentage might just be wrong.
How can I solve that?

over 1 year ago ·