MySQL
Linux
Centos
Ubuntu
PHP
Windows
CSS3
帳號登入
MySQL
Linux
Ubuntu
CentOS
PHP
Windows
CSS3
編碼的世界 / 優質文選 /
生涯
解決css中height:100%失效的問題
2022年3月15日
-
書箋
關於css得height:100%; 不生效問題;
今天在做項目的時候突然遇到height:100%;無效,但是寫上固定高度就好使。
解決方法:
1、html, body { height: 100%; }
2、div { height: 100%; position: absolute; } 前提是,父元素要設置寬高,並且position:relative/absolute.
熱門文章