删除图像边框

时间:2013-06-17 20:16:51

标签: html css

我生气了。我正在尝试删除图像边框,但似乎无法使用此

移动它

HTML:

<img src="../_test.jpg" width="200" height="200" alt="Test">

CSS:

img {
    border: 0px;
    outline: none;
}

Live example

2 个答案:

答案 0 :(得分:0)

There are javascript solutions to handle broken images.

You could also wrap it in a div and do some tricks(这需要在显示alt文本之前留出空格,因为“边框”位于img的填充区域内。 但是,仅处理损坏的图片可能有点过分(修改图片路径)。

<强> HTML

<div class="brokenImgBorderKill">
  <img src="../_test.jpg" width="200" height="200" alt=" Test">
</div> 

<强> CSS

img {
    border: 0px;
    outline: none;
}

.brokenImgBorderKill {
    display: inline-block;
    width: 198px;
    height: 198px;
    overflow: hidden;
}

.brokenImgBorderKill img {
    margin: -1px 0 0 -1px;
}

答案 1 :(得分:-1)

img {
border-style:none;
} 

http://www.w3schools.com/css/css_border.asp;)