4 ms·
Wouldn’t this be fixable by not allowing Stylesheets but only inline style attributes on the tags? To improve usability, email clients could include an automati
by echoangle 3y ago
Wouldn’t this be fixable by not allowing Stylesheets but only inline style attributes on the tags? To improve usability, email clients could include an automatic step where all Stylesheets are “compiled” to inline styles.
The only thing this would break would be advanced CSS selectors (hover etc.) but I’m not sure they would be needed.
- chromanoid 3y agoI agree. Just baking all classes into inline styles before even presenting the mail should fix this. It makes sense to do this anyway. Pseudo classes and media queries wouldn't work, but those would pose a security risk anyway and are not supported by major mail clients (see https://www.caniemail.com/features/css-at-media/ https://www.caniemail.com/features/css-at-media/)
- ketch 3y agoThis would also break the current approach for responsive emails. Usually the default/desktop styles are already compiled and inlined, then a style tag with media query selectors is used in the `head` to improve readability for mobile devices.
- yosefk 3y agoThe horror! Is there a real need here though as opposed to just something people do, and where does such CSS come from in the case of emails? You could be "responsive" by not doing certain things instead of actively doing something and for email content it feels fitting.
- afavour 3y agoYou’re asking if email CSS ever needs to be tailored to mobile devices? It’s not any different than web pages needing to be tailored to mobile devices. The answer is yes, sometimes it is necessary.
- yosefk 3y agoThe answer is different because an email is not a standalone webpage and there are a lot of things you might want to do in a website that you won't expect to be able or need to do in an email. You probably don't want to control font sizes or page margins in an email, for instance; you probably do want to control color or override some overflow defaults. Maybe I'm off in the above but the point is that you expect to control a subset of things for an email (same as eg for RSS entries) and media selectors aren't obviously necessary for these kinds of things.
- afavour 3y agoWhat if you want to place two divs alongside each other on desktop but stacked vertically on a phone?
- bitvoid 3y agoHow about not placing two divs alongside each other in the first place? Every time I see that, I immediately start looking for the unsubscribe link or mark it as spam.
- afavour 3y agoYour preference is not everyone’s preference. It’s silly to suggest every email client disable media queries because you dislike seeing two elements side by side.
- bitvoid 3y agoThat's true, but is anyone going to be up in arms because things are not side by side in an email? I agree with others that emails should just be plain text. It has never bothered me or anyone else I've known to just have plain text and a link that sends them to an actual webpage if HTML is absolutely necessary.
- pembrook 3y agoHTML emails have to inline CSS already due to Outlook & Gmail using decades-outdated rendering engines (outlook literally uses the 2006-era MS Word html engine). Also, killing all style attributes would also kill mobile optimization and dark mode as well, since you cannot inline media queries.
- account42 3y agoAnd we all owe a great debt to Microsoft for preventing the appification of E-Mail.