Home > Web Front-end > HTML Tutorial > Bug: 3px spacing between floating elements in IE6_html/css_WEB-ITnose

Bug: 3px spacing between floating elements in IE6_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:34:46
Original
1313 people have browsed it

Occurrence: An element floats, and then a non-floating element naturally floats up and close to the 3px gap that will appear.

The following are personal tests:

test01: Non-floating elements are block-level elements

<div class="box01">box01</div><div class="box02">box02</div>
Copy after login

.box01{float: left; background: #f1c100;}.box02{background: red;}
Copy after login
Copy after login

ie6 effect: 3px spacing does not appear

test02: not floating The element is modified to an inline element

<div class="box01">box01</div><span class="box02">box02</span>
Copy after login

.box01{float: left; background: #f1c100;}.box02{background: red;}
Copy after login
Copy after login

ie6 effect: 3px spacing appears

 

test03: Repair this 3px spacing (Method 1)

The html structure is according to test02, and the css is as follows:

.box01{float: left; background: #f1c100;}.box02{background: red;_margin-left:-3px;}/*_margin-left:-3px;修复3px间隔bug*/
Copy after login

Effect: No spacing

test04: Repair this 3px spacing (Method 2)

The structure is the same as above, the css is as follows :

.box01{float: left; background: #f1c100;}.box02{background: red;float: left;}/*让不浮动元素也浮动起来*/
Copy after login

Effect: No spacing

Summary:

Based on this, this bug can be improved. Occurrence situation: an element floats, and then a non-floating inline element naturally floats up and close to the 3px gap that will appear.

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template