Reputation: 907
I was trying to put a border fitting a image but with some little space between the border and the image.
I'm using this example http://jsfiddle.net/macwadu/sEz3N/2/
Can anyone help me?
Tanks
Upvotes: 0
Views: 110
Reputation: 41533
demo : http://jsfiddle.net/gion_13/sEz3N/7/
You can actually put the border around the actual image... why make a wrapper that covers the border part? This way you only need to add a bit of padding and you're done.
Upvotes: 1
Reputation: 8963
Remove the inline styling of the image. And do the css like this:
.imagePanel {
-moz-border-radius:10px;
border-radius:10px;
padding: 1px;
border:1px solid grey;
}
.imagePanel img {
-moz-border-radius:10px;
border-radius:10px;
}
like this: http://jsfiddle.net/sEz3N/5/
Upvotes: 2
Reputation: 10315
removed margin and added 20px (from your moz-border-radius)
Upvotes: 2
Reputation: 178413
This seems to be good, when I remove the margin from the image
$(document).ready(function() {
theWidth = $(".imagePanel img").width();
$(".imagePanel").css('width',theWidth+(theWidth*.01));
$(".imagePanel").css('padding',theWidth*.01);
});
Upvotes: 1