When there is a float in the child element of li, a 4px gap bug will occur under the
The code is as follows:
<ul class="list"> <li><div>vapour</div></li> <li><div>百度</div></li> <li><div>淘宝</div></li> <li><div>迅雷</div></li> </ul>
After testing, it was found that the floating sub-element of li is a necessary condition for the occurrence of this bug. The necessary and sufficient condition for the occurrence of this bug is that the sub-element of li is floating and li has one of the following CSS attributes set: width, height, zoom, padding -top, padding-bottom, margin-top, margin-bottom.
Now that we know the conditions for this bug, we have a solution:
Method 1:
#list div sets clear:left|both, then #list li cannot set width, height, zoom.
Method 2:
#list li sets float:left. At this time, #list li can set width, height, and zoom.
#list li sets clear:left|both. At this time, #list li cannot set width, height, and zoom.
Method 3:
This bug in IE6/IE7 can be solved by setting vertical-align:top|middle|bottom to the div in li. It's too weird, just add that the value of vertical-align is one of the three.
The code is as follows:
<span style="color: #0000ff;">DOCTYPE html<span style="color: #0000ff;">> <span style="color: #0000ff;">html<span style="color: #0000ff;">> <span style="color: #0000ff;">head<span style="color: #0000ff;">> <span style="color: #0000ff;">meta <span style="color: #ff0000;">charset<span style="color: #0000ff;">="gb2312" <span style="color: #0000ff;">/> <span style="color: #0000ff;">title<span style="color: #0000ff;">>IE6/IE7中li底部3px的Bug<span style="color: #0000ff;"><span style="color: #800000;">title<span style="color: #0000ff;">> <span style="color: #0000ff;">style <span style="color: #ff0000;">type<span style="color: #0000ff;">="text/css"<span style="color: #0000ff;">><span style="color: #800000;"> ul <span style="color: #000000;">{<span style="color: #ff0000;"> margin<span style="color: #000000;">:<span style="color: #0000ff;"> 0<span style="color: #000000;">;<span style="color: #ff0000;"> padding<span style="color: #000000;">:<span style="color: #0000ff;"> 0<span style="color: #000000;">;<span style="color: #ff0000;"> list-style<span style="color: #000000;">:<span style="color: #0000ff;"> none<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> hr <span style="color: #000000;">{<span style="color: #ff0000;"> clear<span style="color: #000000;">:<span style="color: #0000ff;"> both<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> .list li <span style="color: #000000;">{<span style="color: #ff0000;"> width<span style="color: #000000;">:<span style="color: #0000ff;"> 420px<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> .list div <span style="color: #000000;">{<span style="color: #ff0000;"> float<span style="color: #000000;">:<span style="color: #0000ff;"> left<span style="color: #000000;">;<span style="color: #ff0000;"> width<span style="color: #000000;">:<span style="color: #0000ff;"> 400px<span style="color: #000000;">;<span style="color: #ff0000;"> height<span style="color: #000000;">:<span style="color: #0000ff;"> 24px<span style="color: #000000;">;<span style="color: #ff0000;"> background<span style="color: #000000;">:<span style="color: #0000ff;"> red<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> .v-top div <span style="color: #000000;">{<span style="color: #ff0000;"> vertical-align<span style="color: #000000;">:<span style="color: #0000ff;"> top<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> .v-middle div <span style="color: #000000;">{<span style="color: #ff0000;"> vertical-align<span style="color: #000000;">:<span style="color: #0000ff;"> middle<span style="color: #000000;">; <span style="color: #000000;">}<span style="color: #800000;"> .v-bottom div <span style="color: #000000;">{<span style="color: #ff0000;"> vertical-align<span style="color: #000000;">:<span style="color: #0000ff;"> bottom<span style="color: #000000;">; <span style="color: #000000;">} <span style="color: #0000ff;"><span style="color: #800000;">style<span style="color: #0000ff;">> <span style="color: #0000ff;"><span style="color: #800000;">head<span style="color: #0000ff;">> <span style="color: #0000ff;">body<span style="color: #0000ff;">> <span style="color: #0000ff;">ul <span style="color: #ff0000;">class<span style="color: #0000ff;">="list"<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>vapour<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>百度<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>淘宝<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>迅雷<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;"><span style="color: #800000;">ul<span style="color: #0000ff;">> <span style="color: #0000ff;">hr <span style="color: #0000ff;">/> <span style="color: #0000ff;">ul <span style="color: #ff0000;">class<span style="color: #0000ff;">="list v-top"<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>vapour<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>百度<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>淘宝<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li<span style="color: #0000ff;">> <span style="color: #0000ff;">li<span style="color: #0000ff;">>div<span style="color: #0000ff;">>迅雷<span style="color: #0000ff;"><span style="color: #800000;">div<span style="color: #0000ff;">><span style="color: #800000;">li> <hr> <ul class="list v-middle"> <li><div>vapour</div></li> <li><div>百度</div></li> <li><div>淘宝</div></li> <li><div>迅雷</div></li> </ul> <hr> <ul class="list v-bottom"> <li><div>vapour</div></li> <li><div>百度</div></li> <li><div>淘宝</div></li> <li><div>迅雷</div></li> </ul> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool