Submit your widget

Multiple CSS3 Image Styles

Created 6 years ago   Views 24057   downloads 4621    Author webdesignerwall
Multiple CSS3 Image Styles
View DemoDownload 65.4 KB
104
Share |

When applying CSS3 inset box-shadow or border-radius directly to the image element, the browser doesn't render the CSS style perfectly. However, if the image is applied as background-image, you can add any style to it and have it rendered properly. Darcy Clarke and I put a quick tutorial together on how to use jQuery to make perfect rounded corner images dynamically. Today I'm going to revisit the topic and show you how much more you can do with the background-image CSS trick. I will show you how to use box-shadow, border-radius and transition to create various image styles.

Problem

Take a look at the demo and note that there is border-radius and inset box-shadow applied in the first row of images. Firefox does render border-radius on image element, but doesn't render the inset box-shadow. Chrome or Safari doesn't render the border-radius and inset box-shadow at all.

Workaround

To get the border-radius and inset box-shadow working, the workaround is to apply the actual image as background-image.

Read more:http://webdesignerwall.com/tutorials/css3-image-styles