I’m trying to replicate the CSS ‘Vignette’ effect, detailed on Trent Walton’s site.
.vignette1 {
box-shadow:inset 0px 0px 85px rgba(0,0,0,.5);
-webkit-box-shadow:inset 0px 0px 85px rgba(0,0,0,.5);
-moz-box-shadow:inset 0px 0px 85px rgba(0,0,0,.5);
float: left;
}
.vignette1 img {
margin: 0;
position: relative;
z-index: -1;
width: 320px;
height: 247px;
}
It works well in isolation, but has problems on my production site, where the background settings for a parent div override the z-index on the image – live jsFiddle demo here.
The second approach – mentioned in the original article’s comments and included in the demo – works well, but my image has to be wrapped in the tag – it can’t be below it.
In the end I found the’ Overlay & Inset Method’, the second of Jordon Dobsons’s techniques to be the most effective and least reliant on negative z-indexes:
(jsFiddle demo using original layout)