How do I remove link underlining in my HTML email?
Asked Answered
E

27

37
<td width="110" align="center" valign="top" style="color:#000000;">
    <a href="https://example.com" target="_blank"
       style="color:#000000; text-decoration:none;">BOOK NOW
    </a>
</td>

I used this code to make a link in my HTML email. In browsers and Outlook it's working nicely, but in GMail, Hotmail, and ymail it shows links underlined.

Can anyone help me to get rid of this?

Estaminet answered 25/1, 2012 at 5:44 Comment(8)
Gmail, yahoo take their own formatting in Email while displaying.. may that could be the reason. please check how u can format the text-decoration for gmail, yahoo emails... but not using your account with style sheets..Barker
Try looking at the applied styles in Dragonfly/Firebug/Chrome inspector and see what's overriding your text-decoration: none style.Nicolasanicolau
Can you try adding a different color, say #777777 here and see if it works ? I'm trying to decipher the problem because you kind of have the solution.Histo
On my gmail, an email newsletter containing the link <a href="#" style="text-decoration:none;">foo</a> is NOT underlined. But not sure if different browsers, etc have different behavior.Dowlen
The code you have provided should work in Gmail, Hotmail and Ymail which makes me think that there must be something wrong with your HTML somewhere else which is having side effects. Try to produce the bug with the minimum amount of code possible and see if that helps you work it out.Sprue
1) Which browser are you using with Gmail / Hotmail? Different browsers will sometimes render the email differently. 2) Can you pastebin the rest of the emailer? Might be another CSS rule in the emailer which is causing a problemFerryboat
this is the most shit jobs I have ever done (working on html emails). God bless you boy :DBushwhacker
Hey @pubudumj, can you possibly choose an accepted answer?Basir
I
41
<a href="#" style="text-decoration:none !important; text-decoration:none;">BOOK NOW</a>

Outlook will strip out the style with !important tag leaving the regular style, thus no underline. The !important tag will over rule the web based email clients' default style, thus leaving no underline.

Intervalometer answered 16/1, 2014 at 20:50 Comment(2)
Mailchimp user here, it works like a charm (tested with Gmail). Thanks!Scapolite
I'm here 6 years after this answer, and it indeed works! I'm amazed! 🙌Basir
D
7

I see this has been answered; however, I feel this link provides appropriate information for what formatting is supported in various email clients.

http://www.campaignmonitor.com/css/

It's worth noting that GMail and Outlook are two of the pickiest to format HTML email for.

Daric answered 25/1, 2012 at 6:4 Comment(1)
Text decoration is supported for all clients though, odd that it doesn't work.Mam
B
6

After half a day looking into this (and 2 years since this question was opened) I believe I have found a comprehensive answer to this.

<a href="#"><font color="#000000"><span style='text-decoration:none;text-underline:none'>Link</span></font></a>

(You need the text-underline property on the span inside the link and the font tag to edit the colour)

Biradial answered 28/8, 2014 at 10:10 Comment(3)
I was skeptical when I saw this answer but this actually fixed the issue for me in GMail. text-decoration: none !important just wasn't cutting it. This does indeed remove the underlines. Have an upvote!Crimp
Are you sure this isn't because it's an empty link?Fab
This approach worked for me while the most common ones are not.Devilmaycare
J
5

Use !important in the text decoration rule.

<a href="#" style="text-decoration:none !important;">BOOK NOW</a>
Jumper answered 13/8, 2013 at 11:30 Comment(2)
That's because Outlook strips !importantFab
Not only does Outlook strip !important but it also strips the style it's connected to. In Outlook this would get parsed as <a href="#" style="">BOOK NOW</a> effectively doing nothing.Propertius
B
5

Windows Mail seemed to outright ignore inline text-decoration tag but what fixed it for me was by adding this to the head:

<!--[if (mso)|(mso 16)]>
<style type="text/css">
    body, table, td, a, span { font-family: Arial, Helvetica, sans-serif !important; }
    a {text-decoration: none;}
</style>
<![endif]-->
Behest answered 25/10, 2019 at 18:10 Comment(1)
finally one that works! Thanks bud, Windows Mail was ignoring everything but this solutionGuadalcanal
H
3

Another way to fool Gmail (for phone numbers): use a ~ instead of a -

404-835-9421 --> 404~835~9421

It'll save you (or less savvy users ;-) the trip down html lane.

I found another way to remove links in outlook that i tested so far. if you create a blank class for example in your css say .blank {} and then do the following to your links for example:

<a href="http://www.link.com/"><span class="blank" style="text-decoration:none !important;">Search</span></a>

this worked for me hopefully it will help someone who is still having trouble taking out the underline of links in outlook. If anyone has a workaround for gmail please could you help me tried everything in this thread nothing is working.

Thanks

Hit answered 7/7, 2015 at 13:41 Comment(0)
C
2

I think that if you put a span style after the <a> tag with text-decoration:none it will work in the majority of the browsers / email clients.

As in:

<a href="" style="text-decoration:underline">
    <span style="color:#0b92ce; text-decoration:none">BANANA</span>
</a>
Canberra answered 29/11, 2012 at 17:24 Comment(2)
All you guys who upvoted this, did you actually try it? It doesn't work. The <a> tag still has an underline; it looks no different than <a href="#">BANANA</a>.Dowlen
this is working (sans the anchor declaration) in Office 2010 via parallels for mac running windows 7 and windows XP. The text-decoration declaration for the anchor tag style is unnecessary, however. Please note, this seems to NOT work in many situations if you add !important to the declaration on the span, otherwise it performs as desiredFurie
F
2

I added both declarations on the a href which worked in outlook and gmail apps. outlook ignores the !important and gmail needs it. Web versions of email work with both/either.

text-decoration: none !important; text-decoration: none;
Foreman answered 28/6, 2016 at 16:0 Comment(0)
E
1

All email clients adjust the HTML and the CSS code you provide by their own rules:

e.g.: gmail removes everything but the inner HTML of the body tag.

1. for most other clients you can have a style-tag in your header

<style type="text/css">
    a {text-decoration: none !important;}
</style>

note: don't use CSS comments as YAHOO!Mail might cause trouble.

2. to be on the save side add the same code inline into the A tag as you did and an extra span tag as well (the style rules in a tags get often removed)

<a href="" style="text-decoration: none !important;">
    <span style="text-decoration: none !important;">
        text
    </span>
</a>
Evaporite answered 9/7, 2012 at 2:41 Comment(0)
H
1

To completely "hide" underline for <a> in both mail application and web browser, can do the following tricky way.

<a href="..."><div style="background-color:red;">
    <span style="color:red; text-decoration:underline;"><span style="color:white;">BUTTON</span></span>
</div></a>
  1. Color in 1st <span> is the one you don't need, MUST set as same as your background color. (red in here)

  2. Color in 2nd <span> is the one for your button text. (white in here)

Hypoxia answered 18/10, 2015 at 11:56 Comment(0)
P
1

Text decoration none was not working for me, then i found an email in outlook that did not have the line and checked the code:

<span style='font-size: 12px; font-family: "Arial","Verdana", "sans-serif"; color: black; text-decoration-line: none;'>
<a href="http://www.test.com" style='font-size: 9.0pt; color: #C69E29; text-decoration: none;'><span>www.test.com</span></a>
</span>

This one is working for me.

Parent answered 14/1, 2016 at 0:0 Comment(0)
P
1

I used a combination of not showing links in google, adding links for mso (outlook) and the shy tag, to keep the looks and feels for my company. Some code may be redundant (for my company the looks where more important then the be clickable part. (it felt like a jigsaw, as every change brakes something else)

<td style="color:rgb(69, 54, 53)">
<!--[if gte mso 9]>
<a href="http://www.immothekerfinotheker.be" style="text-decoration:none;">
<span style="text-decoration:none;">
<![endif]-->
www&shy;.&shy;immothekerfinotheker&shy;.&shy;be
<!--[if gte mso 9]>
</a>
</span>
<![endif]-->
</td>

Hope this helps someone

Pericope answered 4/2, 2016 at 16:0 Comment(0)
L
1

In Windows 10 Mail, you might need to add these in your html head:

<!--[if (mso)|(mso 16)]>
  <style type="text/css">
    body, table, td, a, span { font-family: Arial, Helvetica, sans-serif !important; }
    a {text-decoration: none;}
  </style>
<![endif]-->

The 'a {text-decoration: none;}' fixed the underline problems :)

Lumpen answered 21/11, 2018 at 3:25 Comment(0)
B
0

It wholly depends on the email client whether it wants to display the underline under the link or not. As of now, the styles in the body are only supported by:

  • Outlook 2007/10/13 +
  • Outlook 2000/03
  • Apple iPhone/iPad
  • Outlook.com
  • Apple Mail 4
  • Yahoo! Mail Beta

http://www.campaignmonitor.com/css/

Bridgeport answered 18/8, 2013 at 7:57 Comment(1)
The latest Outlook one is false for text-decoration: noneFab
A
0

Use text-decoration:none !important; instead of text-decoration:none; to make sure you "lose" the underline.

Attenuant answered 19/8, 2013 at 8:53 Comment(0)
Y
0

Here in http://www.campaignmonitor.com/css/, a nice explanation to say this is restricted! And a pretty nice guide to know all limitations of CSS in email clients.

Yang answered 19/8, 2013 at 18:7 Comment(0)
F
0

You can do "redundant styling" and that should fix the issue. You use the same styling you have on the but add it to a that is within the .

Example:

<td width="110" align="center" valign="top" style="color:#000000;">
    <a href="https://example.com" target="_blank"
       style="color:#000000; text-decoration:none;"><span style="color:#000000; text-decoration:none;">BOOK NOW</span></a>
</td>
Ferryboat answered 12/2, 2015 at 14:52 Comment(0)
P
0

While viewing the html email try inspecting the element on that link and see what is overwriting it. Use that class and define it that style again in your head style and define the text-decoration: none !important;

In my case these are the classes that are overwriting my inline style so declared this on the head of my html email and defined the style that I want implemented.

It worked for me, hope it will work on your one too.

.ii a[href]{
text-decoration: none !important;
}

#yiv8915438996 a:link, #yiv8915438996 span.yiv8915438996MsoHyperlink{
text-decoration: none !important;
}   

#yiv8915438996 a:visited, #yiv8915438996 span.yiv8915438996MsoHyperlinkFollowed{
text-decoration: none !important;
}   
Pitzer answered 25/3, 2015 at 2:55 Comment(0)
M
0

Code like the lines below worked for me in Gmail Web client. A non-underlined black link showed up in the email. I didn't use the nested span tag.

<table>
  <tbody>
    <tr>
        <td>
            <a href="http://hexinpeter.com" style="text-decoration: none; color: #000000 !important;">Peter Blog</a>
        </td>
    </tr>
  </tbody>
</table>

Note: Gmail will strip off any incorrect inline styles. E.g. code like the line below will have its inline styles all stripped off.

<a href="http://hexinpeter.com" style="font-family:; text-decoration: none; color: #000000 !important;">Peter Blog</a>
Magnetic answered 7/7, 2015 at 5:20 Comment(0)
P
0

I copied my html page and pasted to word. Edited the signature in word deleting the spaces where the underline is placed and make my own "padding" presssing space bar. Copied again and pasted to Outlook 2013. Worked fine for me.

Periwig answered 17/12, 2015 at 23:5 Comment(0)
A
0

In my case, I configured the signature (copy and paste in gmail) using Safari. I tried every code you putted here, but those didn´t worked. After you paste the signature using Safari, you can come back to Chrome and the underline is gone.

Arch answered 2/12, 2022 at 20:49 Comment(0)
D
0

Using text-decoration: unset; inside the style of the element works for GMAIL

Diehl answered 22/2, 2023 at 14:48 Comment(0)
N
0

Just use the following css to avoid anchor tag default css styling:

.ii a[href], a {
        color: inherit !important;
        text-decoration: none !important;
    }
Nord answered 9/7, 2023 at 14:52 Comment(0)
R
0

i tried all the solution above nothing worked. i was wrapping a card inside an anchor tag and no matter what i did the text inside the card always had underline. so what i did was wrap every text inside the card with an anchor tag and assign text-decoration: underline; text-decoration-color: #FFFFFF; styles to the anchor tag. as #FFFFFF was the background color of the card as well the underline disappeared.

<a
    style="
        text-decoration: underline;
        text-decoration-color: #FFFFFF;
    "
>
    BOOK NOW
</a>

if #FFFFFF is not your background color change it to whatever you need.

Retriever answered 8/10, 2023 at 13:36 Comment(0)
W
-1

All you have to do is:

<a href="" style="text-decoration:#none; letter-spacing: -999px;">
Weathertight answered 28/12, 2018 at 7:48 Comment(1)
Whaaaa? How does letterspacing help here?Fab
O
-2

place your "a href" tag without any styling before div / span of text. then make your styling in the div/span tag.

for the most restricted styling email client.

<div><a href=""><span style="text-decoration:none">title</span><a/></div>
Ornithosis answered 23/4, 2019 at 7:56 Comment(0)
S
-3

You should write something like this.

<a href="#" style="text-decoration:none;">BOOK NOW</a>
Spires answered 25/1, 2012 at 5:47 Comment(3)
oh, this is now edited. but the question was not posted like this.Spires
Perhaps <a href="#" style="text-decoration:none !important;">BOOK NOW</a> works?Shalondashalt
The question was posted like this - here is first question versionNitty

© 2022 - 2025 — McMap. All rights reserved.