tl;dr:

Probably best to rely on the advice already given, but here are some soon-to-be-historical details.

On 1/19/15, 11:47 PM, Jukka K. Korpela wrote:

http://pastebin.com/B9zSx0ew <http://pastebin.com/B9zSx0ew>

When I submit a copy of the code to http://validator.w3.org I get
the error message as relating to line 234. That line contains the
start tag of a style element: <style type="text/css">.

Which might actually be able to live there, depending upon your attitude toward the standard and other details.

By HTML rules, a style element may appear only in the head part. In
practice, browsers appear it inside the body element as well, with
no difference in effect. This explains why the page works.

In the dialects of HTML4, this is exactly right, as is the (snipped) succeeding advice to put your most important styles last to guard against conflicts resolved in undesirable ways.

If you rely entirely on the W3C's definitions with respect to HTML5, as does its validator, then this advice is also correct.

HOWEVER...

There are such things as scoped styles, though I get the sense that they appear to be on the way out as Official Things:

https://html.spec.whatwg.org/multipage/semantics.html#the-style-element

http://caniuse.com/#feat=style-scoped

They were also included in earlier iterations of the W3C's HTML5 standard.

Details go on from there, but suffice to say that scoped styles lend themselves to the same sort of abuse as style attributes, and incur great resource expense.


--
Ben Henick              lurker...@henick.net
Sitebuilder At-Large    t:@bhenick
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to