Feel
Feel

Reputation: 51

How I can get rid of border around image?

I can't find a source of problem. I want get rid of border around image.

Problem: http://codepen.io/anon/pen/xeFmt

Solution should be cross browser with support of IE8+.

Upvotes: 1

Views: 913

Answers (5)

Jack Bonneman
Jack Bonneman

Reputation: 1805

w3 says SRC is mandatory.

SRC (Source) The SRC attribute specifies the URI for the image to be embedded. Its syntax is the same as that of the HREF attribute of the tag. SRC is mandatory.

Adding any value to the src (even a missing image) makes the border/outline disappear, without having to modify the css.

Example: http://codepen.io/anon/pen/eaJum

Upvotes: 1

ejscribner
ejscribner

Reputation: 365

Adding an image src="" attribute to it should remove the border but I would also add a border: none; to the CSS.

Upvotes: 0

MMH
MMH

Reputation: 786

As Romain Braun suggested, adding source to the <img/> tag will remove the border.

<img src="http://9to5google.files.wordpress.com/2013/12/google2.jpg" />

Upvotes: 0

Borys Generalov
Borys Generalov

Reputation: 2345

Normally it can be achieved by

border: none;
outline: 0;

But not for the case when actual image is missing, i.e. not loaded or src attribute is not specified

Upvotes: 0

Paul Redmond
Paul Redmond

Reputation: 3296

Normally it would be:

  outline: none;
  border: none;

I suspect CodePen may be adding that so you can see the element or until you add a real src to the tag.

Upvotes: 1

Related Questions