Saturday, March 27, 2010
The Overall Structure: HTML, Head, and Body
Posted by devlevis | Saturday, March 27, 2010 | Category:
learn html,
learn html from scratch,
learn html must for bloggers,
structure of html
|
All HTML documents have three, document-level tags in common. These tags,
<html>, <head>, and <body>, delimit certain sections of the HTML document.
The <html> tag
The <html> tag surrounds the entire HTML document. This tag tells the clientbrowser where the document begins and ends.
<html>
... document contents ...
</html>
Additional language options were declared within the <html> tag in previous
versions of HTML. However, those options (notably lang and dir) have been
deprecated in HTML version 4.0. The language and directional information is
routinely contained in the document type declaration (<!DOCTYPE>).
The <head> tag
The <head> tag delimits the heading of the HTML document. The heading section ofthe document contains certain heading information for the document. The
document's title, meta information, and, in most cases, document scripts are all
contained in the <head> section. A typical <head> section could resemble the
following:
<head>
<link rel-"stylesheet" type-"text/css" href-"/styles.css">
<title>Title of the Document</title>
<meta name-"descriptionâ" " content-"Sample Page" ">
<meta name-"keywords" content-"sample, heading, page">
<script language-"JavaScript">
function NewWindow(url){
fin-window.open(url," ",
"width-800,height-600,scrollbars-yes,resizable-yes" );
}
</script>
</head>
Most of the content within the <head> section will not be visible on the rendered
page in the client's browser. The <title> element determines what the browser
displays as the page title'son Windows machines, the document title appears in the
browser's title bar, as shown in Figure .
The main, visual content of the HTML document is contained within <body> tags.
Note that with HTML version 4.0, most attributes of the <body> tag have been
deprecated in favor of specifying the attributes as styles. In previous versions of
HTML, you could specify a bevy of options, including the document background,
text, and link colors. The onload and onunload attributes of the <body> tag, as
well as global attributes such as style, are still valid. However, you should specify
the other attributes in styles instead of within the <body> tag, such as in the
following example:
<html>
<head>
<title>Document Title</title>
<style type-"text/css">
body { background:black; color:white}
a:link { color: red }
a:visited { color: blue }
a:active { color: yellow }
</style>
</head>
<body>
... document body...
</body>
</html>
Subscribe to:
Post Comments (Atom)



Currently have 0 comments: