CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了css – div height:100%;不能使用display:table-cell;大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码正在工作
<!DOCTYPE html>
<html>
<body style="position:fixed; top:0px; left:0px;bottom:0px; right:0px;  margin:0px;">
<div style="height:100%; width:100%; border:solid;"></div>
</body>
</html>

但是当我添加显示器时不起作用:table-cell;到div使用垂直对齐

<!DOCTYPE html>
<html>
<body style="position:fixed; top:0px; left:0px;bottom:0px; right:0px;  margin:0px;">
<div style="height:100%; width:100%; border:solid; display:table-cell;vertical-align:middle;"></div>
</body>
</html>

我想让div覆盖整个身体的空白空间

解决方法

您的代码现在应该工作.
<html>
<body style="position:fixed; top:0px; left:0px;bottom:0px; right:0px;  margin:0px;">
    <div style='display : table; width : 100%; height : 100%'>
    <div style='display : table-row;'>
        <div style="border:solid; display : table-cell;">
        </div>
    </div>
    </div>
</body>
</html>

Live Example

经验法则:每当显示:table-cell时,始终有一个正确的标记.

大佬总结

以上是大佬教程为你收集整理的css – div height:100%;不能使用display:table-cell;全部内容,希望文章能够帮你解决css – div height:100%;不能使用display:table-cell;所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。