Home Height equal to dynamic width (CSS fluid layout)
Reply: 0

Height equal to dynamic width (CSS fluid layout)

user772
1#
user772 Published in May 21, 2018, 6:49 pm

This question already has an answer here:

  • Maintain the aspect ratio of a div with CSS 18 answers

Is it possible to set same height as width (ratio 1:1)?

Example

+----------+
| body     |
| 1:3      |
|          |
| +------+ |
| | div  | |
| | 1:1  | |
| +------+ |
|          |
|          |
|          |
|          |
|          |
+----------+

CSS

div {
  width: 80%;
  height: same-as-width
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.341328 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO