html - IE中列表之间的差距

标签 html css internet-explorer list

我创建了一个垂直导航,其中包含我创建的按钮。 IE 中的每个按钮之间有很大的差距,我不知道为什么,因为所有边距都是 0!非常困惑,因为它在 Chrome 和 FF 中运行良好。

#buttons {
    float: left;
    padding: 0;
    margin: 0px 10px 10px 20px;
}
#buttons ul {
    display: inline;
}
#buttons ul li  {
    list-style: none;
    text-decoration: none;
    margin: 1px 0;
    clear:both;
}
#buttons ul li #quote{
    width: 270px;
    height: 53px;
    list-style: none;
    background-image: url('buttons.png');
}

#buttons ul li a:hover #quote{
    width: 270px;
    height: 53px;
    background-image: url('buttons.png');
    background-position: 270px 0px;
}
#buttons ul li #sample{
    width: 270px;
    height: 53px;
    list-style: none;
    background-image: url('buttons.png');
    background-position: 0px 53px;
}

#buttons ul li a:hover #sample{
    width: 270px;
    height: 53px;
    background-image: url('buttons.png');
    background-position: 270px 53px;
}
#buttons ul li #plan{
    width: 270px;
    height: 53px;
    list-style: none;
    background-image: url('buttons.png');
    background-position: 0px 106px;
}

#buttons ul li a:hover #plan{
    width: 270px;
    height: 53px;
    background-image: url('buttons.png');
    background-position: 270px 106px;
}
#buttons ul li #callback{
    width: 270px;
    height: 53px;
    list-style: none;
    background-image: url('buttons.png');
    background-position: 0px 159px;
}

#buttons ul li a:hover #callback{
    width: 270px;
    height: 53px;
    background-image: url('buttons.png');
    background-position: 270px 159px;
}

        <div id="buttons">
            <ul>
                <li><a href="#" onClick="openForm()"><div id="quote"></div></a></li>
                <li><a href="#"><div id="sample"></div></a></li>
                <li><a href="#"><div id="plan"></div></a></li>
                <li><a href="#"><div id="callback"></div></a></li>
            </ul>
        </div>

最佳答案

一些旧版本的 IE 不喜欢 <li> 之间的空格标签。

如果您可以访问 HTML,那么您可以通过几种方式解决这个问题。

任一评论:

<li>element One</li><!--
--><li>element Two</li><!--
--><li>element Three</li>...

或单行列表:

<li>element One</li><li>element Two</li><li>element Three</li>...

或者您可以尝试添加 vertial-align: bottom;所有 <li>标签。

关于html - IE中列表之间的差距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12951844/

相关文章:

jquery - 如何在鼠标悬停时缩放图像而不影响其他图像位置?(JQuery)

html - 部分背景图像和线性渐变不起作用

html - 如何在IE中使用border-radius.htc制作圆 Angular

c# - .NET WebBrowser 控件是否可以使用 IE9?

jquery - IE 无法识别 jQuery 选择器

绘制框架时 Javascript Canvas 闪烁

jquery - 我可以在单个 html 页面中多次使用 jquery 的 $(document).ready() 吗?

javascript - react 提到文本区域不随文本增长

html - 背景图

html - 无法在 R 中使用 xpathSapply 选择特定的 html 表