html - Creating an image border around images of variable size with CSS -
i wish put border frame around image - photo frame image. there easy way this? i.e using css purely, ideally i'd recreate 45 degree joins @ edge , realistic possible. snag here image size variable.
i found webpage: http://cssdeck.com/labs/picture-frame-using-box-shadows
run snippet below see how works. purely css, no html , no js involved. effect accomplished using box-shadow
property. of course, code, need include html , set images' sizes (or keep them in percentage - i.e. 100%) , tweak code bit. effect created , works different sized images, need change inset colour values preferred style.
/* pure css picture frame */ html { overflow: hidden; background-color: #653845; background-image: linear-gradient(45deg, hsla(0,0%,0%,.1) 50%, transparent 50%), linear-gradient(-45deg, hsla(0,0%,0%,.1) 50%, transparent 50%); background-size: .25em .25em; box-shadow: inset 0 0 500px hsla(0,0%,0%,.5); height: 100%; padding: 1px; } body { height: 300px; width: 400px; margin: -150px -200px; position: absolute; left: 50%; top: 50%; background: gray url(http://dribbble.com/system/users/13774/screenshots/423481/_111.jpg?1329144172); border: 1px solid; border-color: #bbb #999; box-shadow: 0 2px 5px hsla(0,0%,0%,.4), inset 0 1px 0 #ccc, inset 1px 0 0 #aaa, inset 0 -1px 0 #ccc, inset -1px 0 0 #aaa, inset 0 2px 0 #c6c6c6, inset 2px 0 0 #a6a6a6, inset 0 -2px 0 #c6c6c6, inset -2px 0 0 #a6a6a6, inset 0 3px 0 #c0c0c0, inset 3px 0 0 #a0a0a0, inset 0 -3px 0 #c0c0c0, inset -3px 0 0 #a0a0a0, inset 0 4px 0 #b9b9b9, inset 4px 0 0 #999, inset 0 -4px 0 #b9b9b9, inset -4px 0 0 #999, inset 0 5px 0 #b6b6b6, inset 5px 0 0 #969696, inset 0 -5px 0 #b6b6b6, inset -5px 0 0 #969696, inset 0 6px 0 #b0b0b0, inset 6px 0 0 #909090, inset 0 -6px 0 #b0b0b0, inset -6px 0 0 #909090, inset 0 7px 0 #a9a9a9, inset 7px 0 0 #898989, inset 0 -7px 0 #a9a9a9, inset -7px 0 0 #898989, inset 0 8px 0 #a6a6a6, inset 8px 0 0 #868686, inset 0 -8px 0 #a6a6a6, inset -8px 0 0 #868686, inset 0 9px 0 #a0a0a0, inset 9px 0 0 #808080, inset 0 -9px 0 #a0a0a0, inset -9px 0 0 #808080, inset 0 10px 0 #888, inset 10px 0 0 #666, inset 0 -10px 0 #888, inset -10px 0 0 #666, inset 0 0 10px 10px hsla(0,0%,0%,.5); }
p.s. further style photos, can add bevel effect. google (or whatever search engine prefer) how if aren't familiar yourself, when searched "css image bevel" lots of resources available , many ways create effect exist.
hopefully you're looking for! enjoy!
Comments
Post a Comment