简体   繁体   中英

How do I make the padding of a link clickable in IE 6?

By default, only the text of links is clickable in IE 6. I'd like to make the entire area inside the link (ie including padding) clickable as well.

I also need this area to be transparent, as the link covers half of a photo. Adding a background color makes the padding area clickable, but defeats the object, as the link is hidden.

I could have sworn there was a way to do this.

display: inline-block; usually works for me.

display: inline-block is the correct answer, as Kobi says. There is no div or transparent div behind it, just the link element. When the inline-block attribute is applied to it, any padding (and I think line-height) becomes as if it were part of the link.

I remember having come across the same problem but my recollection is hazy about the proper workaround (and if there even was one).

Can you try giving the link a background-color: transparent or a transparent background image? That might work.

If nothing else helps, give the surrounding element a Javascript onclick attribute, and cursor: pointer to simulate link functionality at least for those with JavaScript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM