views:

458

answers:

2

I have a box in one of my websites that has a these property:

-moz-box-shadow:inset 0 0 50px #ecf4de;
-webkit-box-shadow:inset 0 0 50px #ecf4de;
box-shadow:inset 0 0 50px #ecf4de;

This gives the box a nice gradient towards the center. However, Safari does not support the "inset" property and IE doesn't support box-shadow at all. I can't use an image for this because the height of this box changes for each situation.

I don't want to use 3 images, (one for the top, a repeating one for the middle and one for the bottom), as this can get very messy code.

So what I'm asking is if there is any way to produce the box shadow in all browsers.

EDIT: Anybody know of some javascript snippet that could possibly do this? Just wondering...

A: 

The latest Webkit build (and probably many before) has support for inset. It will probably get to Safari for the next release.

However, you won't be able to do it on all browsers without the three images trick. Internet Explorer's not going to collaborate with you otherwise.

That being said, I don't think your goal should be to get identical results in all browsers. I think you should get decent results in all browsers, but it's normal that web pages in Safari or Firefox look better than in Internet Explorer 7. Besides, only web geeks compare web page rendering across different browsers.

zneak
A: 

Agreed; to be honest, I've no qualms about leaving my pages looking blander and blockier on Internet Explorer than superior browsers. The content is still readable, accessible, and navigable: but screw getting it pixel perfect between browsers. If anything, it'll just give Microsoft all the more incentive to improve their browser's support for CSS3.

Personally, I think the inset flag is one of the most awesome features being promised by box-shadows... aside from giving elements a depressed, "cut-out" effect, inset shadows can also be used to create glowing edges and angled shading, an effect that can't be easily achieved using straight background gradients (especially with rounded edges). Being able to inset shadows opens up a whole wealth of opportunities for web design.

Knowing that Safari didn't support it had me worrying it might be dropped from the spec at some point: God knows there's no reason to drop something so useful. >_>

Alhadis