Thursday, 5 February 2015

STRUSTURING YOUR HTML

 HTML defines three tags that are used to describe the page’s overall structure and provide some simple header information. These three tags-<html>, <head>, and <body>-identify your page to browsers or HRML tools. They also provide simple information about the page (such as its title or its author) before loading the entire thing. The page structure tools that interpret or filter HTML files.
In the strict HTML definition, these tags are optional. If your page does not contain them, browsers usually can read the page anyway. These tags, however, are required elements in XHTML 1.0. the most recent browsers already take advantage of XHTML. You should get into the habit of including the page structure tags now.which your page conforms, and the document type definition(DTD) that defines the specification. This is followed by the <html>,<head>, and <body> tags . in the following example. The XHTML 1.0 strict document type appears before before the page structure tags:
<D DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 strict//EN”
“http:// www.W3,org.TR.xhtml 1/DTD/strict.dtd”>
<html>
<head>
<title>page title</title>
</head>
<body>
….your page content…..
</body>
</html>
Three types of HTML 4.01 document types are specified in the XHTML 1.0 specification: strict, transitional, and frameset. Refer to lesson 16, “writing good web pages: Do’s and don’ts,” for more information about the DOCTYPE tag, and more information about the differences between strict, transitional, and frameset document types.
THE <HTML> TAG
The first page structure tag in every HTML page is the <html> tag. It indicates that the content of this file is in the BTML language. In the XHTML 1.0 recommendation, the <html> tag should follow the DOCTYPE identifier (as mentioned in the previous note) as shown in the following example.
All the text and HTML elements in your web page should be placed within the beginning and ending HTML tags, like this:

<! DOCTYPE html PUBLIC “-//W3C //DTD XHTML 1.0 transitional //EN”
<html>
….your page…..
Before XHTML 1.0, you could play fast and lose with the tags in your documents. In order for your HTML to be valid, you needed to include the <html> tag around all the other tags in your document, but none of the popular browsers cared if you really did. If you left them out, or included the beginning <html> tag but not the closing tag, or whatever, the browser would still display the document without complaining. With XHTML 1.0, you  HTML documents must also be valid  XML documents require all the elements in a file to be enclosed within a root element. In XHTML 1.0 documents, thje root element is the <html> tag.
Here’s a typical example of how you properly use the <head> (you’ll learn about
<title> later):
< ! DOCTYPE html PUBLIC “-/w3c//DTD XHTML 1.0 transitional//EN”
<html>]
<head>
 <title> this is the title. It will be explained later on</title>
</head>
…your page…
</html>

No comments:

Post a Comment