DIV中标签影响高度解决思路
DIV中<h>标签影响高度
以上是我的测试代码。
DIV中包含一个h3标签,单独用$("body>div:first>h3").outerHeight(true)取h3的高度可以取到包含Margin的总高度,但是
用$("body>div:first").outerHeight(true)取div的总高度却不包含margin的高度,求高手帮忙
------解决思路----------------------
饿..
LZ改成<div style="display:inline-block;">再看看
------解决思路----------------------
剛替你畫了一張圖解:
你可以將h3設display:inline-block; width:100% 解決
<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的高度,求高手帮忙
------解决思路----------------------
饿..
LZ改成<div style="display:inline-block;">再看看
------解决思路----------------------
剛替你畫了一張圖解:
你可以將h3設display:inline-block; width:100% 解決