0
<img class="image_cover" src = "" />

.image_cover {
    width:25px;
    height:25px;
    border-style:none;
    border: 0;
    box-shadow:none;
}

I'm demonstrating it in a fiddle here: jsfiddle

In Chrome Version 33.0.1750.152, I am seeing a box (border) over the <img> tag. I am trying to get rid off it.

I followed the input over here: Removing the image border in Chrome/IE9, and set the border, border-style, and box-shadow attributes, but I still see the border around it.

How do I fix this?

Community
  • 1
  • 1
Louis93
  • 3,843
  • 8
  • 48
  • 94

6 Answers6

4

Chrome automaticaly renders a border to img tags with an empty src attribute.

A workaround would be placing a transparent png or gif in this image tag.

Martin Lantzsch
  • 1,851
  • 15
  • 19
2

CSS

img {
    Border: none;
}

try this and it should remove any default borders

Chris
  • 435
  • 7
  • 19
  • 1
    Does not work. http://jsfiddle.net/H4TNw/10/ – Louis93 Mar 28 '14 at 15:35
  • 1
    @Louis93 it works when you have an image placed in the SRC. This then prevents any borders appearing on any other browser round the img – Chris Mar 28 '14 at 15:41
1

It is because you don't have a source specified. Once you specify an SRC, this shouldn't be a problem any longer.

Patrick Allen
  • 2,148
  • 2
  • 16
  • 20
1

Like others have mentioned the border is there because the SRC is empty. If the src wasn't empty you could change the border using border:none. However this is happening because of default browser behavior on an <img> tag with no src which is why border:none has no effect.

If for whatever reason you want to have an empty src you could do this.. But I am not sure why you would want an image tag with no src

<img class="image_cover" src="" />

.image_cover {
    width:25px;
    height:25px;
    content: "";
}

DEMO:

http://jsfiddle.net/krishollenbeck/H4TNw/8/

khollenbeck
  • 16,028
  • 18
  • 66
  • 101
0

the outline shows up because you are not setting the src attribute to a valid image url.

Bilal
  • 429
  • 1
  • 3
  • 11
0

Getting rid of the outline is accomplished by making it transparent.

img{    
    border-color:transparent;
}
web-tiki
  • 99,765
  • 32
  • 217
  • 249
Sireesh Yarlagadda
  • 12,978
  • 3
  • 74
  • 76