最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

DIV中<h>标签影响高度_html/css

来源:懂视网 责编:小采 时间:2020-11-27 16:33:30
文档

DIV中<h>标签影响高度_html/css

DIV中<h>标签影响高度_html/css_WEB-ITnose: $(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:f
推荐度:
导读DIV中<h>标签影响高度_html/css_WEB-ITnose: $(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:f


 

xyz



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


回复讨论(解决方案)

有人没啊,快来看看啦

饿..

LZ改成再看看

这是display属性详解 http://www.w3school.com.cn/cssref/pr_class_display.asp,

lz也可以把div加个float:left试试.

css-box模型还是挺复杂的

这是display属性详解 http://www.w3school.com.cn/cssref/pr_class_display.asp,

lz也可以把div加个float:left试试.

css-box模型还是挺复杂的



好像还是不行啊


这是display属性详解 http://www.w3school.com.cn/cssref/pr_class_display.asp,

lz也可以把div加个float:left试试.

css-box模型还是挺复杂的



好像还是不行啊


没问题啊float, 和 display:inline-block之后会被内部元素完全撑开

事?上div的margin-top是collepse h3??的 margin-top,但?不算在div,所以div??的outerheight ?比h3?的低



这是display属性详解 http://www.w3school.com.cn/cssref/pr_class_display.asp,

lz也可以把div加个float:left试试.

css-box模型还是挺复杂的



好像还是不行啊


没问题啊float, 和 display:inline-block之后会被内部元素完全撑开



前后不换行的...

?替你?了一??解:


你可以?h3?display:inline-block; width:100% 解?

?充:
在?ie下h3要?
h3{
display:inline-block;
*display:inline;
*zoom:1;
}

?充:
在?ie下h3要?
h3{
display:inline-block;
*display:inline;
*zoom:1;
}



谢谢了,你的图很有用哦。分给你了

”事?上div的margin-top是collepse h3??的 margin-top“ 这个是你根据实际情况总结的还是官方文档有说的?


?充:
在?ie下h3要?
h3{
display:inline-block;
*display:inline;
*zoom:1;
}



谢谢了,你的图很有用哦。分给你了

”事?上div的margin-top是collepse h3??的 margin-top“ 这个是你根据实际情况总结的还是官方文档有说的?



官方文?: http://www.w3.org/TR/CSS2/box.html 8-3-1底下其中一行
top margin of a box and top margin of its first in-flow child

文档

DIV中<h>标签影响高度_html/css

DIV中<h>标签影响高度_html/css_WEB-ITnose: $(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:f
推荐度:
标签: 标签 html 高度
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top