Table of Contents
xyz        " >            xyz        
回复讨论(解决方案)
Home Web Front-end HTML Tutorial DIV中<h>标签影响高度_html/css_WEB-ITnose

DIV中<h>标签影响高度_html/css_WEB-ITnose

Jun 21, 2016 am 09:23 AM
div lt Influence Label

<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>
Copy after login

<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>
Copy after login


以上是我的测试代码。
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
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

VBOX_E_OBJECT_NOT_FOUND(0x80bb0001)VirtualBox error VBOX_E_OBJECT_NOT_FOUND(0x80bb0001)VirtualBox error Mar 24, 2024 am 09:51 AM

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

How effective is receiving phone calls using airplane mode? How effective is receiving phone calls using airplane mode? Feb 20, 2024 am 10:07 AM

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

How to search for text across all tabs in Chrome and Edge How to search for text across all tabs in Chrome and Edge Feb 19, 2024 am 11:30 AM

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

How to turn off the comment function on TikTok? What happens after turning off the comment function on TikTok? How to turn off the comment function on TikTok? What happens after turning off the comment function on TikTok? Mar 23, 2024 pm 06:20 PM

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 &quot;I&quot; in the lower right corner to enter the settings menu. 3. In the settings menu, find &quot;Privacy Settings&quot;. 4. Click &quot;Privacy Settings&quot; to enter the privacy settings interface. 5. In the privacy settings interface, find &quot;Comment Settings&quot;. 6. Click &quot;Comment Settings&quot; to enter the comment setting interface. 7. In the comment settings interface, find the &quot;Close Comments&quot; option. 8. Click the &quot;Close Comments&quot; option to confirm closing comments.

File Inclusion Vulnerabilities in Java and Their Impact File Inclusion Vulnerabilities in Java and Their Impact Aug 08, 2023 am 10:30 AM

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

The impact of data scarcity on model training The impact of data scarcity on model training Oct 08, 2023 pm 06:17 PM

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.

What problems will bad sectors on the hard drive cause? What problems will bad sectors on the hard drive cause? Feb 18, 2024 am 10:07 AM

Bad sectors on a hard disk refer to a physical failure of the hard disk, that is, the storage unit on the hard disk cannot read or write data normally. The impact of bad sectors on the hard drive is very significant, and it may lead to data loss, system crash, and reduced hard drive performance. This article will introduce in detail the impact of hard drive bad sectors and related solutions. First, bad sectors on the hard drive may lead to data loss. When a sector in a hard disk has bad sectors, the data on that sector cannot be read, causing the file to become corrupted or inaccessible. This situation is especially serious if important files are stored in the sector where the bad sectors are located.

How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? Mar 22, 2024 am 10:28 AM

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

See all articles