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!
Written by Netzach IO
Related protips
1 Response
I'm using this. However, when there's border the percentage might just be wrong.
How can I solve that?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#