3 ms·
Wouldn't most of these pains go away if you simply could include style tags (not attributes) in the body? I've always wondered why it's possible to include scri
by pvorb 3y ago
Wouldn't most of these pains go away if you simply could include style tags (not attributes) in the body? I've always wondered why it's possible to include script tags pretty much everywhere but not style tags.
- hdodov 3y agoNope, that doesn't work as well. I tested it before finishing up the article a few days ago. If you put `<style>` in the `<body>`, it gets removed when the email is forwarded and it still looks like shit.
- pvorb 3y agoThat's why I said "if you could". I know it's not valid HTML. For some reason, style tags are only allowed inside the <head/>. My point was that I find it strange that HTML in general has this limit and that script tags are allowed in the <body/> as well.
- hdodov 3y agoI had missed the "if you could" part, sorry. Browsers are actually okay with <style> tags in the <body> and apply the rules inside. Although MDN says they must be placed in the <head> [1]. Email clients seem to be a lot more restrictive, apparently. Or lazy. [1](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style https://developer.mozilla.org/en-US/docs/Web/HTML/Element/st...)
- pvorb 3y agoHuh, I didn't know browsers are behaving this way these days. I believe I tried this several years ago and it didn't work. Or did I just read the standard? I'm not sure. Anyway, I always assumed it wouldn't work.