IE7中列表项之间的CSS间隙 [英] CSS gap between list items in IE7

查看:138
本文介绍了IE7中列表项之间的CSS间隙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法清除IE7中列表项之间的差距。

I'm unable to remove the gap between the list items in IE7.

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="base.css" />
    </head>
    <body>
        <ul>
            <li>
                <div>row 1.1</div>
                <div>row 1.2</div>
            </li> 
            <li>
                <div>row 2.1</div>
                <div>row 2.2</div>
            </li> 
            <li>
                <div>row 3.1</div>
                <div>row 3.2</div>
            </li> 
        </ul>
    </body>
</html>

CSS:

ul
{
    padding: 0px;
    margin: 0px;    
}

li
{
    list-style-type: none;      
    width: 100%;    
    margin: 0px;
    padding: 0px;   
    border-bottom: 1px solid black;
    border-left: 1px solid black;
    border-right: 1px solid black;          
}

li:first-child
{
    border-top: 1px solid black;
}

li div
{
    float: left;
    width: 49.9%;
}


推荐答案

c> li 太

float the li too

li
{
    list-style-type: none;      
    width: 100%;
    float: left;    
    margin: 0px;
    padding: 0px;   
    border-bottom: 1px solid black;
    border-left: 1px solid black;
    border-right: 1px solid black;          
}

这将修复IE7(这是IE7中的一个已知问题)让其他浏览器同时包含子浮动项(他们不在做)

this will fix IE7 (it's a known issue in IE7) but it will also get other browsers to contain the child floats at the same time - (which they weren't doing)

添加:### 工作示例 ###

added: ### Working Example ###

这篇关于IE7中列表项之间的CSS间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆