0

Am I going mad. I'm trying to remove the image border, but can't seem to shift it with this

HTML:

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

CSS:

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

Live example

user229044
  • 222,134
  • 40
  • 319
  • 330
Rob
  • 1,359
  • 5
  • 28
  • 55

1 Answers1

0

There are javascript solutions to handle broken images.

You could also wrap it in a div and do some tricks (this requires a space before your alt text to show, as the "border" is within the padding area of the img). However, this is probably a bit excessive for just handling a broken image (fix your image path instead).

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;
}
Community
  • 1
  • 1
ScottS
  • 70,348
  • 13
  • 121
  • 143