28

I designed an HTML email and I am having the following issues: First my entire design is based on a blue color so any blue text will not be readable by the reader/user, text has to be white. GMAIL automatically color phone numbers and links blue but the main problem is Microsoft Outlook OWA.

To fix the phone number and link coloring in GMAIL I did the following:

<a style="color: #FFFFFF; 
   text-decoration: none" 
   href="#/">
       <span style="color: #FFFFFF; 
                    text- decoration: none">
           1800-000-0000
       </span>
</a>

This works perfectly for GMAIL and every where else BUT as I mentioned most of my client uses Outlook or MS OWA (Outlook Web Application).

OWA ignores the color I set in my inline style and makes the link default blue; this only happens when the email is previewed. If you actually open the email all the styles kicks in.

My dilemma is, what should I do? I have already given up hope but this is my last resort. Is there a way to override the link color for Outlook OWA? I have used !IMPORTANT, the FONT tag, NESTING to the 5 degree.

The Problem here is not Outlook but OWA.

Here is a screenshot when I inspect the element in Chrome:

Screenshot of Google Chrome Developer Panel

And here is FF:

enter image description here

Any ideas?

Please!

Sumama Waheed
  • 3,579
  • 3
  • 18
  • 32
Asynchronous
  • 3,917
  • 19
  • 62
  • 96
  • 1
    Have you inspected it in the browser during the state where the style is not applied? With Firebug or Chrome Console, you should be able to determine what's overriding the style you've set. Also, just a wild guess, have you tried a `` insert? – Jared Farrish Aug 19 '12 at 09:26
  • Where would I be putting this style? And no I have not inspected anyting because I was under the impression that even if you knew that, you cannot control it.?? Not sure, just a thought. By the way don't styles get stripped if they are not inline? – Asynchronous Aug 19 '12 at 09:38
  • If you find the style which is overridden, you might be able to override that with an `!important` addition to your style. Usually I find this a bad practice, but this might be a case where it is a good idea. – Hidde Aug 19 '12 at 09:41
  • Have you ever tried looking at the codes in there? So I right click o the element in my page and click inspect? Not really seeing anything but I am sure something is there, the code is so long. – Asynchronous Aug 19 '12 at 09:50
  • Can you copy in all the css you see in the 'inspect element' from Google Chrome? – Hidde Aug 19 '12 at 13:03
  • In Firefox/Chrome hover your mouse over the element in question, right-click, and `Inspect Element`. I prefer and know best Firebug, so in that you'll see the `HTML` tab in focus, and on the far right right a box with `Style` tab focused. You can look at the styles applied per element by clicking on each in the left `HTML` tab, which will update the right. Scroll through the `Style` tab and you'll see which are active and which are being overridden (will be struck through). More or less, you have to do this to figure out what is going on, and should learn to do this anyways. It's pretty handy. – Jared Farrish Aug 19 '12 at 15:16
  • And, y'know, it's better than guessing and adding `!important` to everything. Note, there is also `! important` (with a space). – Jared Farrish Aug 19 '12 at 15:18
  • I did just that, but again I am not seeing any that appears to be over writing the inline style sheet. I have added a screen shot above. The anchor tag I am using has no Class, I am using only inline styles. – Asynchronous Aug 19 '12 at 20:53
  • You might want to change the link background (or its surrounding background) if its text color can't be overridden. – Jay Aug 20 '12 at 06:39

14 Answers14

58

You'll find success by including the <font> declaration, which is deprecated in modern HTML, though some versions of OWA still respect it:

<a style="color: #FFFFFF; text-decoration: none" href="#/">
  <span style="color: #FFFFFF; text-decoration: none">
    <font color="#FFFFFF">1800-000-0000</font>
  </span>
</a>
Alter Lagos
  • 12,090
  • 1
  • 70
  • 92
estaples
  • 932
  • 8
  • 9
12

Outlook Web App (OWA) link colors change from inline styles. I have spent a few hours trying to change/fix link colors in OWA where it strips away inline styles for email templates I am creating. I tried various techniques with + tags with no success. Finally found something that seems to work:

      <a href="http://www.somewebsite.com.au/" target="_blank" style="color:#FFFFFF;">White Link</a>

Changed it to:

      <a href="http://www.somewebsite.com.au/" target="_blank" style="color:#FFFFF6;">White Link (almost)</a>

Seems fine so far.

Further testing. I put the slightly off color on the the <td style="color:#FFFFF6;"> then the correct color on the <a href="http://www.somewebsite.com.au/" target="_blank" style="color:#FFFFFF;">

Kerry Smyth
  • 165
  • 1
  • 9
10

Its a known bug with Outlook that if an anchor tag does not contain a valid URL, then the styling of said tag will be ignored.

The tendancy to add !important will also work against you in this case because Outlook will completely ignore any tags suffixed with !important.

Put a URL on your anchor tag, or wrap the text in a span tag inside of the anchor and put your styling there.

davidcondrey
  • 34,416
  • 17
  • 114
  • 136
7

I have been able to fix this by putting a table inside the a tag.

<a href="">
    <table>
        <tr>
            <td style="color: #FFFFFF">Link text here</td>
        </tr>
    </table>
</a>
kavun
  • 3,358
  • 3
  • 25
  • 45
1

Figures. Just when we've gotten used to not being able to use the cool new email tricks because Outlook doesn't support them, Microsoft throws OWA at us, with a whole slew of new bugs.

We've gotten around its awful link styling by applying a display:inline-block to the link. This at least gets rid of the underline. I have no idea why.

We ran into another bug when trying to style our links the same color as the parent element. For some reason, making the parent element's color different fixed it. Changing it by one character up or down usually gives you a pretty close color.

<td style="color:#CCCCCD">
<a href="http://mylink" style="display:inline-block; color:#CCCCCC">Link</a>
</td>
Bill Malcolm
  • 266
  • 2
  • 8
1

I used the following and it worked fine in Outlook 2007, 2010, 2013, and Outlook.com. I will check with OWA soon.

#outlookLink {text-decoration: none; color: #ffffff !important}
<a href="" id="outlookLink" name="Anchor" style="text-decoration: none; color: #ffffff !important;">Your text and link here.</a>
  • Please check it first then answer. OP is asking about OWA specifically, so this is not an answer. Once you get enough reputation, you'll be able to comment, too where this kind of post belongs. – YakovL Sep 19 '16 at 22:57
1
<a href="#" style="color: #FFF;">
  <strong style="color: #FFF; font-weight: normal;">Example Link</strong>
</a>

it worked for me! Make sure to use <strong>, I tried it with other tags, but that didn't work.

Alter Lagos
  • 12,090
  • 1
  • 70
  • 92
leon
  • 11
  • 1
1

I have also noticed that for OWA the order of items in the style= property might be relevant. I've seen cases when using:

<a href="/some_url" style="text-decoration: none; color: inherit;">...</a>

Would cause OWA to strip the color attribute (but leave `text-decoration), but reversing the order, e.g.:

<a href="/some_url" style="color: inherit; text-decoration: none;">...</a>

Would make OWA preserve both. I can't see any sense in this, but this is how it is...

I've also see that the context of a tag can influence this style-stripping: The stripping I mentioned above is triggered when the a tag is preceded by a h2 tag, but removing that h2 also prevents OWA from stripping the tag (I haven't investigated when or why this happens exactly, though, just wanted to point out that context can be relevant here as well).

I realize that none of this is a direct answer to the original question, but I imagine it will be helpful for others who come here with a similar question.

Matthijs Kooijman
  • 2,498
  • 23
  • 30
0

OWA is actually stripping all the styles of the a-tag, including that of the span-tag you included. You can add styles in the head part, but again, OWA is ignoring this for hyperlinks. I added a style for a, a:link, a:visited in the head, the same color as in the a-tag and the including span-tag. The result? My linktext is colored but the underlining is still the default blue. The clue: there's no clue for me.

Geert
  • 29
  • 1
0

When sending html emails the best practice is to stick to old HTML3 and HTML4. Email clients do not play well with CSS2 and up. Inline CSS work much better.

Instead of:

<a style="color: #FFFFFF; text-decoration: none" href="#/">
 <span style="color: #FFFFFF; text- decoration: none">1800-000-0000</span>
</a> 

By the way, you have syntax errors in this line, after each css declaration you need a ;

Corrected:

<a style="color: #FFFFFF; text-decoration: none;" href="#">
  <span style="color: #FFFFFF; text- decoration: none;">1800-000-0000</span>
</a> 

Try this:

<a color="#FFFFFF" text-decoration="none" href="#">
  1800-000-0000
</a>

Do not forget to specify the HTML version on the DOCTYPE.

I've found myself working in both sides of this situation. I worked on a web based email client using PHP with IMAP, I had to strip HTML emails of a lot of things because they'd break not only the layout of the app but also the intended behavior of buttons and forms. How? you might ask. With a desktop email client this probably wouldn't be a problem but with a web based email client loading external css/js files can result into a very large array of potential pitfalls and nasty bugs.

On another occasion I was working on wedding invitations sent over HTMl emails, The amount of inline css we had to do was ridiculous. To make it work on you have to use mostly HTML3 and maybe a bit of HTML4 but not too much.

I recommend you to experiment with tables and deprecated HTML3 inline css.


  • 1
    BTW @darwin... Last declaration in the line doesn't *need* the semi. I thought it did as well, but it is perfectly valid. HOWEVER.. it is a poor practice for future expansion so not recommended. Refer to a good answer here: http://stackoverflow.com/questions/11939595/leaving-out-the-last-semicolon-of-a-css-block – Phlume Feb 21 '14 at 15:28
0

Try adding a class my-link to each link in question and the following CSS in your style tag:

.my-link a,
a[x-apple-data-detectors] {
  color:inherit !important;
  text-decoration: underline !important;
}

That usually covers things for me. If that fails, there is a heavier version of this code here:

.my-link a,
a[x-apple-data-detectors] {
    color: inherit !important;
    text-decoration: none !important;
    font-size: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

source

Ted Goas
  • 7,051
  • 1
  • 35
  • 42
0

I saw this thread and tried the options above. The TD hack worked with changing the hex code, but I just stumbled upon a nice solution if anyone would like to try:

<div style="text-decoration: none;">
<a href="LINK" style="display: inline-block; color: #878f93; text-decoration: none;">LINK TEXT</a>
</div>

Setting the DIV to text-decoration NONE was supported by OWA. I personally was asked to remove the underline, so for my case it's perfect.

I hope people find this useful. Thanks for everyone who added their solutions as well.

pitzki
  • 147
  • 1
  • 2
  • 10
0

This question is still relevant as of today 21-12-2017. I had no problem with my code in Outlook, Gmail but not in Outlook Web App. I had to use this outdated tag to solve it.

<a class="app-link" style="font-size:14px; color:#ff6600 !important; text-decoration:underline;" href="https://somesite/something/"><font color="#ff6600 !important;"> Gå til app</font></a>

It was weird that style within hyperlink will NOT work for Outlook Web App(OWA), therefor, adding <font color="#ff6600 !important;"> worked! Strange but this is how Microsoft wants to tease us!

curious.netter
  • 774
  • 10
  • 16
-1

**

PSEUDO CSS SUPPORTED (2007, 2010, 2016, 2017 and others)

It is like a hack because it doesn't support.

<a href="#" target="_blank" style="font-size:20px;">
   <strong style="color:#ffffff;">@Model.TelephoneTextHtml</strong>
</a>
Vinod Kumar
  • 1,191
  • 14
  • 12