DIV中<h>标签影响高度_html/css_WEB-ITnose
<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 id="nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-span-nbsp-id-pass-title-xyz-span-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp"> <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改成
这是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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

When trying to open a disk image in VirtualBox, you may encounter an error indicating that the hard drive cannot be registered. This usually happens when the VM disk image file you are trying to open has the same UUID as another virtual disk image file. In this case, VirtualBox displays error code VBOX_E_OBJECT_NOT_FOUND(0x80bb0001). If you encounter this error, don’t worry, there are some solutions you can try. First, you can try using VirtualBox's command line tools to change the UUID of the disk image file, which will avoid conflicts. You can run the command `VBoxManageinternal

What happens when someone calls in airplane mode? Mobile phones have become one of the indispensable tools in people's lives. It is not only a communication tool, but also a collection of entertainment, learning, work and other functions. With the continuous upgrading and improvement of mobile phone functions, people are becoming more and more dependent on mobile phones. With the advent of airplane mode, people can use their phones more conveniently during flights. However, some people are worried about what impact other people's calls in airplane mode will have on the mobile phone or the user? This article will analyze and discuss from several aspects. first

This tutorial shows you how to find specific text or phrases on all open tabs in Chrome or Edge on Windows. Is there a way to do a text search on all open tabs in Chrome? Yes, you can use a free external web extension in Chrome to perform text searches on all open tabs without having to switch tabs manually. Some extensions like TabSearch and Ctrl-FPlus can help you achieve this easily. How to search text across all tabs in Google Chrome? Ctrl-FPlus is a free extension that makes it easy for users to search for a specific word, phrase or text across all tabs of their browser window. This expansion

Java is a commonly used programming language used to develop various applications. However, just like other programming languages, Java has security vulnerabilities and risks. One of the common vulnerabilities is the file inclusion vulnerability (FileInclusionVulnerability). This article will explore the principle, impact and how to prevent this vulnerability. File inclusion vulnerabilities refer to the dynamic introduction or inclusion of other files in the program, but the introduced files are not fully verified and protected, thus

On the Douyin platform, users can not only share their life moments, but also interact with other users. Sometimes the comment function may cause some unpleasant experiences, such as online violence, malicious comments, etc. So, how to turn off the comment function of TikTok? 1. How to turn off the comment function of Douyin? 1. Log in to Douyin APP and enter your personal homepage. 2. Click "I" in the lower right corner to enter the settings menu. 3. In the settings menu, find "Privacy Settings". 4. Click "Privacy Settings" to enter the privacy settings interface. 5. In the privacy settings interface, find "Comment Settings". 6. Click "Comment Settings" to enter the comment setting interface. 7. In the comment settings interface, find the "Close Comments" option. 8. Click the "Close Comments" option to confirm closing comments.

The impact of data scarcity on model training requires specific code examples. In the fields of machine learning and artificial intelligence, data is one of the core elements for training models. However, a problem we often face in reality is data scarcity. Data scarcity refers to the insufficient amount of training data or the lack of annotated data. In this case, it will have a certain impact on model training. The problem of data scarcity is mainly reflected in the following aspects: Overfitting: When the amount of training data is insufficient, the model is prone to overfitting. Overfitting refers to the model over-adapting to the training data.

When browsing Douyin works, we often see a clock icon behind the tag. So, what exactly is this clock? This article will focus on the discussion of "What is the clock behind the Douyin label", hoping to provide some useful reference for your use of Douyin. 1. What is the clock behind the Douyin label? Douyin will launch some hot topic challenges. When users participate, they will see a clock icon after the tag, which means that the work is participating in the topic challenge and displays the remaining time of the challenge. For some time-sensitive content, such as holidays, special events, etc., Douyin will attach a clock icon after the label to remind users of the validity period of the content. 3. Popular tags: When a tag becomes popular, Douyin will add a clock icon after the tag to indicate that the tag is

As a popular short video social platform, Douyin has a huge user base. For Douyin creators, using tags to attract traffic is an effective way to increase the exposure of content and attract attention. So, how does Douyin use tags to attract traffic? This article will answer this question in detail for you and introduce related techniques. 1. How to add tags on Douyin to attract traffic? When posting a video, make sure to choose tags that are relevant to the content. These tags should cover the topic and keywords of your video to make it easier for users to find your video through tags. Leveraging popular hashtags is an effective way to increase your video’s exposure. Research current popular tags and trends and incorporate them into your video descriptions and tags. These popular tags usually have higher visibility and can attract the attention of more viewers. 3. Label
