HTML and CSS Reference
In-Depth Information
When loading the page, this will show a pop-up with either “CSS1Compat” or “Back-
Compat.” The former means the mode is set to no-quirks mode; the latter means it is
set to quirks mode.
One last note in regard to doctypes: in order to be compatible with legacy systems
that generate HTML code and therefore require the doctype syntax to look more like it
previously has, the following alternative doctype declaration for HTML5 is acceptable:
<!DOCTYPE html SYSTEM "about:legacy-compat">
This is provided only for systems producing HTML, so it is unlikely that you, as a
web page author, would use this declaration unless you wanted to give your fingers an
additional workout or show your friends that you are a master of the smallest nuances of
HTML5.
Simplified character encoding
The HTML you type is text, right? Well, to you it is, but to the computer it is stored as a
series of bits: 1s and 0s. Therefore, a particular character is actually stored as a particular
binary number. A computer program (such as a web browser) reading a text document
needs to know two things fundamentally:
• That what it is reading is supposed to be text
• Which convention is being used to map the bits it reads to the repres-
entation of a particular character of text
This second point is referred to as the
character encoding
for the document. Think
of it as like the old telegraph system of communicating, where messages were sent as
Morse code and subsequently translated into letters and words. To successfully transmit
text using Morse code, the sender and the receiver both need to know how the clicks
being sent map to particular letters. The character encoding tells the computer how to
translate the bits and bytes it reads into letters for display or other purposes.
The HTML5 specification strongly recommends that all HTML documents have a
character encoding set. The recommended way is to have the server send this as part of
the response headers, in the
HTTP Content-Type
header, but if this is not possible, the
meta
HTML element can be used in the head section of the HTML document. The most
widely used character encoding system in use on the Web is UTF-8, which can encode
more than 1 million characters covering most written language scripts in use around the
world.
In HTML 4.01, the
meta
element looked like this:
Search WWH ::
Custom Search