views:

18

answers:

1

Some 'buttons' (divs with background images) on my webpage have shadow effects in the image. I don't want the shadow area to cause a click event. Is there any relatively simple way to reduce the active area of a div using css? Or are there any standard techniques for doing this?

I have a click effect when the button is pressed (using :active) which I'd like to keep..

alt text

+3  A: 

Add another div inside with proper size and margins that handles the click instead.

You also make have some luck with using negative margins, but cross browser support for that is poor.

Squeegy
Thanks Squeegy. The problem with that (1st suggestion) is that the ':active' css dies; I can't use :active to have a click effect on the larger div anymore, as it would still cause the click effect when the large div is clicked, although nothing would actually happen as the click handler is on the smaller div.Should have mentioned that. I'll update the questions.
Mr. Flibble
Actually, that will work, thanks Squeegy. Will just mean moving some css about.
Mr. Flibble