图像在IE中仍然有边框

图像在IE中仍然有边框

本文介绍了为什么即使IE边框没有设置,图像在IE中仍然有边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下代码,我在IE7到IE9的背景图像周围得到边框.为什么?

With the following code, I get a border around my background image in IE7 to IE9. Why?

<tr>
    <td class="wishes">
        <a class="clickable">
            <img class="alreadyWished" border="0" width="19" height="16"
                alt="Already Wished"/><br />
            Already Wished
         </a>
     </td>
</tr>

<style>
.clickable
{
    outline:none;
    cursor:pointer;
    border:none;
}

.wish
{
    background-image:url(../images/wished.jpg);
    background-repeat:no-repeat;
    border:none;
    outline:none;
}

.alreadyWished
{
    background-image:url(../images/alreadyWished.jpg);
    background-repeat:no-repeat;
    border:none;
    outline:none;
}
</style>

推荐答案

那是IE中的错误. CSS 规格说明

That's a bug in IE. The CSS specs say

...


无边界;计算出的边框宽度为零.

none
No border; the computed border width is zero.

IE不在乎.您需要另外设置border-width: 0. (或border: 0 none;)如果要使用组合名称.

IE doesn't care. You need to set border-width: 0 additionally. (Or border: 0 none;) if you want to use the combined name.

这篇关于为什么即使IE边框没有设置,图像在IE中仍然有边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 18:16