【问题标题】:IE problem - Unwanted margin around imagesIE 问题 - 图像周围不需要的边距
【发布时间】:2011-08-27 15:34:18
【问题描述】:

http://www.wedevents.com.au/index.asp

在 FF 中没有问题,但在 IE 中,顶部和底部菜单中的图像周围会出现一些不需要的白边。

关于如何删除不需要的边距有什么想法吗?

HTML:

<ul class="topnav">
<li>
    <a href="http://www.wedevents.com.au/index.asp"> 
    <img src="/images/menu_home.gif" name="home" onMouseOver="over(0)" onMouseOut="out(0)" alt="Home" /></a>
</li>
<li>
    <a href="http://www.wedevents.com.au/about.asp"> 
    <img src="/images/menu_about.gif" name="about" onMouseOver="over(1)" onMouseOut="out(1)" alt="About" /></a>
</li>

CSS:

ul.topnav {
list-style: none;
padding: 0 85px;
margin: 0 auto;
width: 630px;
height: 36px;
background: #b09a27;
font-size: medium;
text-align: left;
}
ul.topnav li {
float: left;
margin: 0;
padding: 0;
position: relative;
}
ul.topnav li a{
padding: 0;
color: #fff;
display: block;
text-decoration: none;
float: left;
}

【问题讨论】:

    标签: css internet-explorer margin


    【解决方案1】:

    图像上没有边距或填充。用户代理样式默认为在图像周围放置边框。在图像上设置border: 0;。另请参阅 reset.css 的其他答案,以防止将来发生此类事情。

    【讨论】:

    • 谢谢!你知道为什么我的页脚包装器中的 margin-bottom: 40px 在 IE 中被忽略了吗?其他页面均未受影响,但主页的独特之处在于底部没有该徽标和 bg 图像。
    • @Rick,我会提出另一个问题。
    【解决方案2】:

    尝试使用 reset.css 这是我喜欢的一个 http://meyerweb.com/eric/tools/css/reset/

    【讨论】:

    • 很棒的提示。我会在需要时保留它的快捷方式。
    猜你喜欢
    • 1970-01-01
    • 2011-09-19
    • 1970-01-01
    • 1970-01-01
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-12
    相关资源
    最近更新 更多