css浮动的ie7兼容问题,下边距增加_html/css_WEB-ITnose
大box内左右浮动两个box,左侧box内有黄色部分(不浮动)和下方左右浮动的两个蓝色部分。
在IE7下,大box下方似乎多了一个padding-bottom的距离,现在要求内部所有部分高度是自动的。
正常情况下:
ie7下:
不使用的方法:
1、黄色部分也浮动;//因为右侧黄色box有时内部也有复杂的内容布局,不能做到全部浮动
2、ie7hack;
3、固定高度;
那么还有高明的什么方法呢?
代码如下
<style>*{ margin:0; padding:0;}li{ list-style:none;}.fix{zoom:1;}.fix:after{content:""; display:block; clear:both; height:0; visibility:hidden;}.box{ width:400px; margin:0 auto; border:1px solid #f69; margin-bottom:20px; margin-top:50px;}.box_left{ width:260px; float:left;}.box_right{ width:120px; float:right; background:#FFC;}.not_float{ width:100%; height:40px; margin-bottom:20px; background:#FFC;}.ready_float_left{ width:160px; float:left; background:#09f; color:#fff;}.ready_float_right{ width:80px; float:right; background:#09f; color:#fff;}.box2{ width:400px; height:100px; margin:0 auto; border:1px solid #f69;}</style></head><body><div class="box fix"> <div class="box_left"> <div class="not_float"> </div> <div class="ready_float_left"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </div> <div class="ready_float_right"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </div> </div> <div class="box_right"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </div></div><div class="box2"></div>
回复讨论(解决方案)
.not_float{ width:100%; height:40px; background:#FFC;}.ready_float_left{ width:160px; float:left; margin-top:20px; background:#09f; color:#fff;}.ready_float_right{ width:80px; float:right; margin-top:20px; background:#09f; color:#fff;}
not_float 的margin-bottom出问题,增加一个向左浮动float:left;

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

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

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex
