Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add border around image without destroying layout?

Tags:

html

css

960.gs

Site: is here

picture html:

<img alt="" src="UserFiles/Image/galerie/12970854473D-Eco-60.jpg">

when I add border: 2px solid black; to the image

layout breaks...

like image 945
easyrider Avatar asked Jan 27 '26 20:01

easyrider


2 Answers

The only straight-forward solution to your problem that I can see is

outline: 2px solid black

which is layout neutral. However, it doesn't work in IE < 8.

like image 183
Pekka Avatar answered Jan 29 '26 08:01

Pekka


For the record, an alternative:

border: 2px solid black;
margin:-2px;

First you add 2px to all sides, and then you pull them back in with the negative margin.

like image 41
DanMan Avatar answered Jan 29 '26 08:01

DanMan