DIV中标签影响高度

哋岼線 哋岼線 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<script type="text/javascript">
$(document).ready(function () {
//parent.$.modalbox.resize({w: 500, h: 300});
//parent.$.modalbox.moveto("center");
console.warn($("body>div:first").height());
console.warn($("body>div:first").outerHeight(true));
console.warn($("body>div:first>h3").height());
console.warn($("body>div:first>h3").outerHeight(true));
})
</script>

<body>
<div>
<h3 style="margin-top:10px;
margin-bottom:10px;">
<span id="pass-title">xyz</span>
</h3>
</div>
</body>


以上是我的测试代码。
DIV中包含一个h3标签,单独用$("body>div:first>h3").outerHeight(true)取h3的高度可以取到包含Margin的总高度,但是
用$("body>div:first").outerHeight(true)取div的总高度却不包含margin的高度,求高手帮忙
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
哋岼線
CSS 61,116 成员 60,701 内容