A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

CSS in <body>: How to align spec and practice in the future?

Thomas_Guttler
2021-09-16

AFAIK up to now the only way to define a inline CSS Rule (<style>...</style>) is in the <head> tag.

But the daily practice looks quite different. For example amazon.com has several css rules defined in the <body>

If the spec and the practice is so different, then I think this should get fixed.

I guess it is impossible to convince all these sites which use CSS in <body> to obey the spec.

For me the only feasible solution is to change the spec. But maybe there are better solutions.

What do you think?

simevidas
2021-09-16

To be clear, we’re talking about <style>, not <link rel=stylesheet>. All browsers seem to support it. Amazon uses it. Adding it to the HTML Standard would make sense. However, the editors have decided against it.

See https://github.com/whatwg/html/issues/1605

Thomas_Guttler
2021-09-16

Thank you very much for this link!