2

I know how to use the CSS property "display: block" on an anchor to get it to make an entire cell clickable. However, this doesn't seem to work within an HTML email. Any ideas on how to get this to work in an email?

Thanks!

3

3 Answers 3

0

Many email clients strip out css styles from the head and they don't work, so you have to use inline styles (ie putting <a style="display:block;"> etc).

1
  • seeing this post it might help to add !important ?
    – ptriek
    Dec 13, 2011 at 15:00
0

Taken from this solution

display: block in the links works for everything but IE/Windows. If you give the block an explicit width of 100%, then IE/Windows plays along. But doing this creates problems with IE5/Mac and Netscape/Mozilla. So you have to use the child selector“>” to redefine the width to auto. Since IE/Windows doesn’t understand child selectors, it ignores the rule. IE5/Mac, Opera and Netscape/Mozilla follow the rule, and everyone is happy:

#yourdiv a {
        display: block;
        width: 100%;
        }

html>body #yourdiv a {
        width: auto;
        }
1
  • are you using width/height values? I'm looking for alternatives, but that might be a problem... try adding them
    – Yisela
    Dec 13, 2011 at 16:29
0

I would put a TABLE element inside the anchor element, with width=100% and push the anchor out to fill its container from within.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.