css - Border inside an image with margin -


this question has answer here:

how can achieve effect css:

do need smaller div margin , border or somehow possible using box-shadow

you need single element :before or :after

the demo : http://jsfiddle.net/6a95a/1/

the markup:

<figure></figure> 

enter image description here

the style

figure{     width:200px;     height: 180px;     position:relative;     background-image:url(http://24.media.tumblr.com/tumblr_m2scelxyga1qbmtexo1_500.jpg);     background-size:cover;     background-position:50%; } figure:before{     content:'';     position: absolute;     left: 2%;     top: 2%;     width: 95%;     height: 95%;     border: 1px solid white; } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -