HTML and CSS Reference
In-Depth Information
Discussion
The Document Type Definition, or DOCTYPE, tells browsers and validators what
version of HTML the page is written in. Previous versions of HTML specified the ver-
sion number, such as the DOCTYPE for XHTML 1.0 Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
With HTML5, the version is dropped from the DOCTYPE. This allows HTML5 to be
backward compatible in terms of syntax and hopefully makes the transition to HTML5
easier.
Let's say you have a site that is valid HTML 4.0, but you want to transition it to HTML5.
All you have to do to make this a valid HTML5 site is make this DOCTYPE change.
Additionally, all browsers recognize the shortened DOCTYPE and render in strict
standards mode.
There are some elements that have changed between HTML4 and
HTML5, so you will need to watch for elements that have been removed
or deprecated. For example, center might not technically validate as
HTML5.
See Also
The W3C Working Draft discussion on differences between HTML4 and HTML5
includes DOCTYPE at http://www.w3.org/TR/html5-diff/#doctype .
1.2 Specifying the Character Set
Problem
You need to define the character encoding of your web page.
Solution
In your document head , add a meta declaration for the character set:
<meta charset="UTF-8" />
Discussion
The character encoding instructs browsers and validators what set of characters to use
when rendering web pages. If you do not declare the character set in your HTML,
browsers first try to determine the character set from your server's HTTP response
headers (specifically, the Content-Type header).
 
Search WWH ::




Custom Search