开发者

Scaling a div with drop shadow on patterned background - solutions?

开发者 https://www.devze.com 2022-12-19 03:11 出处:网络
I\'m designing a page that has a Content Area which scales against a diagonally striped background. The Content Area div is a fixed width that will scale vertically with content. Because the border i

I'm designing a page that has a Content Area which scales against a diagonally striped background.

The Content Area div is a fixed width that will scale vertically with content. Because the border is a drop shadow, I have a repeating background image (40px wide by 80px high) that has to line up with the page background image. I need the div to scale in multiples of 80px high so that the repeating backgrounds concur with each other.

Is there an elegant solution that will allow me to scale the Content Area div so that it always displ开发者_JAVA技巧ays at a multiple of 80px high? If not, is there another approach I can take to solving this problem rather than scaling the div to a multiple of 80px?

Thanks in advance!

Ryan


Unless you absolutely need the drop shadow to appear in older browsers, you can generate it with the CSS3 box-shadow property instead of using an image. This is much more flexible as the shadow is generated by the browser and will fall nicely on the background regardless of how things line up.


Jimmy's idea is solid, assuming the browser supports this css property. Another, weirder idea to consider might be to have jquery insert a div into the DOM that has fixed positioning and is offset to your content div and a z-index that would put it behind your content div. Then you could this new under-div an opacity (you can use fadeTo but maybe there's something better). Basically give the content div a real shadow by having an identically sized div underneath with 50% opacity.


why dont you leave the stripped background out of the content areas and use a transparent png for the images that will use a drop shadow. Since you're already trying to use javascript to fix a css problem, why not use DD_belatedPNG so that the alpha transparency will display correctly in IE6

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号