加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 设置div max height不起作用

发布时间:2020-12-14 19:37:49 所属栏目:资源 来源:网络整理
导读:我有这个简单的 HTML htmlhead style /style/headbodydiv style="position: relative; overflow: visible; width: 100%; height: 100%;" class="surface" div style="width: 300px; max-height: 2px; height: 2px; position: absolute; left: 36.165px; top:
我有这个简单的 HTML
<html>
<head>
    <style>
    </style>
</head>
<body>
<div style="position: relative; overflow: visible; width: 100%; height: 100%;" class="surface">
    <div style="width: 300px; max-height: 2px; height: 2px; position: absolute; left: 36.165px; top: 0.8957px; border: 1px solid red;"></div>
    <div style="width: 1px; height: 200px; position: absolute; left: 30.165px; top: 47.8957px; border: 1px solid red;"></div>   
</div>
</body>
</html>

基本上有两个div:一个是“水平”(高度为2px),另一个是“垂直”(高度为2px).

当我在firefox上查看页面时:

而在IE(8)上发生的事情发生了:

顶级DIV不是2px高.

知道为什么会这样吗?

解决方法

您的解决方案:

1).添加显示:阻止你的风格

2).检查你有一个正确的DOCTYPE否则(IE)怪癖模式将产生意想不到的格式和结果. Check this article for reference

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读