Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
434 views
in Technique[技术] by (71.8m points)

html - Email signature

So I have made a email signature and it works fine in desktop Gmail. The problem is that when I open an email in desktop Outlook links turn blue and underline . How can I fix this?

This is my HTML

<td style="font-family:'Open Sans', sans-serif;color:#000000;font-size:9px;line-height: 14px;font-weight: 400;">
    <a style="color:#000000!important;text-decoration:none!important;" href="" target="_blank" data-saferedirecturl="">
        Av.Infante Santo, 69 a-c | 1350-177 Lisboa - Portugal
    </a>
</td> 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When Gmail spots an address or phone number in an email, it automatically adds an extra style declaration, which formats any link in the email that has no inline styles attached to it, as blue:

.ii a[href] { color: #15c; }

How to fix?

Option 1:

  • Wrap the telephone number or address in a <span></span>
  • Give the <span> a class. Example: <span class=”contact”></span>
  • Declare the class in the <style> section of your email.

CSS:

.contact a {color:#000000!important; text-decoration:underline!important;}

HTML:

<span class="contact">675 Massachusetts Ave.<br>Cambridge, MA 02139, USA</span>

Option 2:

Add a default styling for all links created by Gmail, for this to work you will need to add an id of body (in this example) to the body of your email.

CSS:

u + #body a {
    color: inherit;
    text-decoration: none;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    line-height: inherit;
}

HTML:

<body id="body">
</body>

If you want to read more about Gmail links here is the source of the above example code which explains everything fully.

Option 3: (which I usually use)

Add a zero width non joiner code (&zwnj;) and space (&nbsp;) to the address or phone number so the numbers don't become a link. This is usually client request to disable link.

HTML:

1&zwnj;3&zwnj;5&zwnj;0-1&zwnj;7&zwnj;7 Lisboa

All CSS you need in this example will be the ones you use on your HTML/

Hope this answers your question.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...