Sunday, July 02, 2006

Heading

Translations

Headings in XHTML are written just like paragraphs, except then instead of marks „<p>“ and „</p>“ they are surrounded by marks „<h1>“ and „</h1>“, or „<h2>“ and „</h2>“,... and so on until „<h6>“ and „</h6>“. The numbers specify headings and subheadings; for example the heading of the chapter is „h1“ and the heading of the section in this chapter is „h2“.

<h1>Domestic animals</h1>

<h2>Dog</h2>

<p>Dog is man's best friend.</p>

<h2>Cat</h2>

<p>Cat catches mice.</p>

It is also possible to specify a page title using the mark „<title>“ in the page header. This title is not displayed in the page text. It appears on the top of the internet browser, or in the browser tab. If you add this page to your list of favourite pages, it will be displayed with this title.

<title>Domestic animals  -- The Animal Encyclopaedia</title>

The page title and the topmost heading are two independent information, though it is often logical to use the same text (both of them describe what the page contains). The page title is displayed only in the browser title, but not in the page. The topmost heading appears only in the page.

Headings of different levels are usually displayed by different font sizes. The topmost heading must always be „h1“ - it is an error to use a mark for subheading just because we want smaller font. The font sizes of the headings and subheadings can be set like this:

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Domestic animals  -- The Animal Encyclopaedia</title>
<style type="text/css">
h1 {
 font-size: 18pt;
}
h2 {
 font-size: 14pt;
}
p {
 font-size: 12pt;
}
</style>
</head>
<body>

<h1>Domestic animals</h1>

<h2>Dog</h2>

<p>Dog is man's best friend.</p>

<h2>Cat</h2>

<p>Cat catches mice.</p>

</body>
</html>

The resulting page looks like this. (The web browser window's title will be: „Domestic animals -- The Animal Encyclopaedia“).

Domestic animals

Dog

Dog is man's best friend.

Cat

Cat catches mice.

0 Comments:

Post a Comment

<< Home