高度等於動態寬度(CSS 流體佈局)[重複] - Height equal to dynamic width (CSS fluid layout) [duplicate]

問題:

This question already has answers here : 這個問題在這裏已經有了答案
Closed 6 years ago . 6年前關閉。

Is it possible to set same height as width (ratio 1:1)?是否可以設置與寬度相同的高度(比例爲 1:1)?

Example例子

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

CSS CSS

div {
  width: 80%;
  height: same-as-width
}

解決方案:

參考一: https://en.stackoom.com/question/MqcV
參考二: https://stackoom.com/question/MqcV
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章