Prevent word wrap on hyphen in html email in Outlook 2007 and Outlook 2010
Solution 1
How about non-breaking hyphen ‑
Solution 2
Use the <nobr>
tag.
E.g. <nobr>978-0-8050-9466-4</nobr>
Solution 3
I needed to have an element not break in an email viewed through Outlook 2013, but not break on spaces. As much as I hate hacking, the way I tackled this issue was to use non-breaking hyphens, but set their color to the background-color of their parents:
<div style="background-color: #fff; color: #000;">
New<span style="color: #fff;">‑</span>Listing
</div>
SneakyOne
Updated on June 04, 2022Comments
-
SneakyOne about 2 years
This is my first post. So:
I'm working on an HTML e-newsletter using the same template I've used for a while now. The template has worked well until recently (the bit of code I have been using is below). Suddenly Outlook 07/10 are not behaving the same way I perceived that they had behaved in the past. They don't appear to be honoring white-space attribute when it comes to hyphens. All other email clients are behaving as I expect (they're honoring white-space attribute).
One of the elements in the newsletter is an ISBN, which is a set of digits separated by hyphens like, "978-1-555-97610-1". The ISBN is in a span tag that is part of a line of text inside a p tag that along with many other p elements, and possibly an img, reside inside a table. I need to prevent ISBNs from breaking on hyphens and wrapping onto new lines.
I can't use non-breaking hyphens, and I have researched this problem a lot in the past (I get a lot of ISBNs in my line of work), so I hope I'm not posting something that's already been answered a billion times.
Any help is deeply appreciated!
Thanks, Andrew.
CODE:
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #000000; margin-bottom: 0px; text-align: right;"> Metropolitan Books · 384 pages · $18.00 · paperback · <span style="white-space: nowrap;">978-0-8050-9466-4</span> </p>
-
SneakyOne about 12 yearsInteresting! The
<NOBR>
tag appears to be deprecated/not supported, but that's never stopped me in the past. Alas, my line still breaks on the hyphen in Outlook 07/10. Good thought, though. -
Krazer about 12 yearsHave you tried using a non-breaking hyphen character (
‑
)? -
SneakyOne about 12 yearsNon-breaking hyphen works, but I am looking for a solution that doesn't rely on them. I don't think there's a way around using them, though. Kind of unfortunate, I think. Thanks for your ideas!
-
SneakyOne over 10 yearsHi Rudolfs, could you explain what you mean?
-
SneakyOne over 8 yearswithWow, that's clever. For some reason that I don't remember, I couldn't use non-breaking hyphens for this particular assignment. On a slightly different note, I recently tried zero-width spaces (​) around hyphens to control word breaks. It passed cross-browser Acid testing, but my ESP actually stripped them out, leaving the dreaded '?' in its place.
-
István Ujj-Mészáros about 8 yearsYou can use non breaking spaces,
works in Outlook 2013 too. Non breaking hyphens are only required when you actually want to have hyphens.