HTML and CSS Reference
In-Depth Information
1.3 Specifying the Language
Problem
You want to specify the primary language of your web page.
Solution
Add the
lang
attribute and appropriate value to your opening
html
element:
<html
lang="en"
>
Discussion
Browsers, screen readers, and other user agents use the
lang
attribute to determine the
language in which the content should be interpreted. The example above specifies
English via the
en
value.
Declaring a document's primary language isn't a requirement for HTML5 (or any of
the previous versions, for that matter). It is, however, a good practice for both usability
and accessibility.
See Also
Mark Pilgrim's “Dive Into Accessibility” discussion about identifying your document
1.4 Optimizing <script>s and <link>s
Problem
You want to reference JavaScripts and include links to external CSS files in your web
page as simply as possible.
Solution
Include
script
and
link
declarations, but
without
the
type
attribute:
<link rel="stylesheet" href="styles.css" />
<script src="scripts.js"></script>
Discussion
HTML5 requires only the minimum amount of information needed for user agents. In
previous versions of HTML, both CSS
link
s and
script
s required the
type
attribute to
indicate the language. If you forgot to include
type
, though, most browsers assumed
the correct value.