HTML and CSS Reference
In-Depth Information
Your browser displays the Web page shown in Figure 1-6. Note that in this case,
the page title appears in the browser tab; in other cases, it will appear in the
browser's title bar. The page itself is empty because you have not yet added any
content to the body element.
Figure 1-6
Viewing the initial HTML fi le in a Web browser
docum e nt title
appear s in the
browser tab
no content appears
in the page body
Converting an HTML Document into XHTML
There is considerable overlap between HTML and XHTML. You can quickly change
an HTML document into an XHTML document just by altering the first three lines of
code. To convert an HTML file into an XHTML file, replace the doctype and the opening
<html> tag with the following:
<?xml version=”1.0” encoding=”UTF-8” standalone=”no” ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=” http://www.w3.org/1999/xhtml”>
Since XHTML is an XML vocabulary, the first line notifies browsers that the document
is an XML file. The version number—1.0—tells the browser that the file is written in
XML 1.0. The second line provides the doctype for an XHTML document written under
a strict interpretation of XHTML syntax. The third line of the file contains the opening
<html> tag. In XHTML, the <html> tag must include what is known as a namespace
declaration indicating that any markup tags in the document should, by default, be
considered part of the XHTML language. Because XML documents can contain a mixture
of several different vocabularies, the namespace declaration is necessary to specify the
default language of the document. With these three lines in place, browsers will recog-
nize the file as an XHTML document.
Search WWH ::




Custom Search