HTML and CSS Reference
The type attribute specifies the MIME type of the resource being linked. It is purely
advisory to the browser (for example, the user agent won't solely rely on the value spe-
cified here to determine the resource type) and can be omitted for style sheets since they
are the most commonly encountered type of file used in the link element.
The style element
The style element allows CSS style rules to be embedded directly into an HTML doc-
ument, which may be a quick and convenient way to add style rules when creating a
page, but as with the global style attribute, the CSS styles for a document are best
provided through linking an external style sheet into the page using the link element.
One new attribute is the scoped attribute, which (in theory) allows a piece of generic
CSS to be applied to a specific block of HTML. However, at the time of writing, the
current releases of major web browsers do not support this attribute.
Adding behavior and fallbacks: script and noscript
The script element is like the style and link elements combined, because it sup-
allows a script to be loaded as an external file. As with CSS, unless it is unavoidable to
that is loaded, like so:
The previous code snippet shows the general appearance of the script element
a directory named js ). Note that when linking in an external script, the element should
not contain any content between its starting and ending tags.
HTML5 defines a new attribute named async , which in combination with another
attribute, defer , can be used to control when an externally loaded script is parsed.
These are both Boolean attributes, so their presence and absence can affect the loading
of external scripts in various ways ( Table 2-6 ).