Inline CSS styles ignored (possibly single quotes appear)



Message Compose Window
7 years ago
2 years ago


(Reporter: Simon, Unassigned)


Windows 7

Firefox Tracking Flags

(Not tracked)


(Whiteboard: dupme)



7 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/7.0.544.0 Safari/534.10
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20101027 Thunderbird/3.1.6

Inline CSS styles in HTML emails are ignored under certain conditions.

This is the simplest test code which reproduces the issue:

<div style="background-color: Red; font-family: 'Trebuchet MS', Times New Roman, sans-serif;">Hello World</div>

(feel free to specify another multiple-word font if you don't have these to test with)

Reproducible: Always

Steps to Reproduce:
1. Compose new email message
2. Select the body of the email
3. Insert > HTML.  Paste in <div> tag as displayed above
4. Note: Font is displayed as intended
5. File > Save
6. Close compose window
7. Navigate to recently saved message in "Drafts" folder
8. Note: font color is correct, but font-family is completely ignored

If the email is "Sent" rather than saved as a draft the same issue occurs.  It also does not need to be a <DIV> tag.  Other tags also feature the same bug.

Bizarre workarounds:
* Place font-family as the first property in the style attribute
* Remove single quotes
* Specify 1-2 fonts rather than 3 or more

Took me forever to troubleshoot and nail down this bug.  Bug only occurs when font-family follows another attribute, contains single quotes, and is within a list of 3+ alternative fonts.  Really not sure why that combination fails.

Related consequences:
If draft is edited and saved again, the font-family attribute is completely removed from the code.


7 years ago
Version: unspecified → 3.1
font families with spaces in must be enclosed in quotes. You've done this with Trebuchet MS but not with Times New Roman. I imagine the style outght to be ignored altogether from the off.

Comment 2

7 years ago
Hi Robert, thanks for replying.  Quoting is optional, however, and if you replace 'Times New Roman' with another font, I believe this bug still persists.  And it's interesting that this bug actually vanishes if you remove the quotes completely (works as expected).

From W3 CSS 2.1 spec:
"If quoting is omitted, any white space characters before and after the font name are ignored and any sequence of white space characters inside the font name is converted to a single space."

Whiteboard: dupme
You need to log in before you can comment on or make changes to this bug.