更新时间:2021-07-11 05:58:53
100%高度使用顶部:0; left:0; bottom:0; right:0;
You can make 100% width and 100% height using top: 0; left: 0; bottom: 0; right: 0;
例如:你有一个div没有固定宽度&该div的高度。在这种情况下,你可以应用这种风格,使100%宽度&
Example: You have one div there is no fixed width & height for that div. in this case you can apply this style and make 100% width & height.
div{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
JSFIDDLE DEMO