如何删除图片的边框?

时间:2017-03-29 09:39:31

标签: html css

我在StackOverflow example1 example2上创建了许多类似我的问题,但由于未知原因,我的图像周围仍然显示了一些边框:

enter image description here

 .imgCadenas{
  width:  50px;
  height: 50px;
  background: url('/cadenas.png');
  background-repeat: no-repeat;
  background-position: right;
  background-size: 100%;

  border:0;
  border-style: none;

  position: absolute;
  right: 150px;
  top: 5px;
}

有人有解决方案吗?

[编辑]与您的建议我在浏览器中有这个CSS: enter image description here



.liMachine {
    list-style-type: none;
    border-style: solid;
    margin-bottom: 5px;
    word-break: break-all;
    position: relative;

}

.imgCadenas{
  width:  50px;
  height: 50px;
  background: url('http://icons.iconarchive.com/icons/paomedia/small-n-flat/256/sign-check-icon.png');
  background-repeat: no-repeat;
  background-position: right;
  background-size: 100%;

  border: 0 !important;
  border-style: none !important;
  outline: none !important;
  display: block;

  position: absolute;
  right: 250px;
  top: 5px;
}

.whoLock{
  position: absolute;
  right: 15px;
  top: 10px;
}

<li class="liMachine switch">
        <div id="nameMachine">
            <h3>My machine</h3>
        </div>
        <div id="stateMachine">
            State:<span class="state">running</span>
        </div>
        <div>
            <img class="imgCadenas">
            <p class="whoLock">Locked by: StackOverflow</p>
        </div>
    </li>
&#13;
&#13;
&#13;

4 个答案:

答案 0 :(得分:1)

这可以在不同的浏览器上更改。您可以尝试pleaseWait.Close();

所有img:

border-style:none !important;

或仅为你的img

img{border-style:none !important;}

如果您发送链接进行控制。我可以找你。

答案 1 :(得分:1)

尝试修改如下:

.imgCadenas{
  width:  50px;
  height: 50px;
  background: url('/cadenas.png');
  background-repeat: no-repeat;
  background-position: right;
  background-size: 100%;

  border: 0 !important;
  border-style: none !important;
  outline: none !important;

  position: absolute;
  right: 150px;
  top: 5px;
}

<强> EDITED

您的img元素缺少src属性, 尝试将img元素更改为div元素。

另见: https://stackoverflow.com/a/22097004/4964262

答案 2 :(得分:1)

添加!重要的CSS会删除边框吗?

答案 3 :(得分:1)

尝试使用。

img {
    border:none;
    outline:none
}