HTML ROOT ELEMENTS

 

XHTML
(eXtensible HyperText Markup Language)

HTML Root, HEAD and BODY Tags
<html
  xmlns="https://www.w3.org/1999/xhtml"
  xml:lang="en"
The html element is the "root" element of the document, and the opening and closing html tags enclose all the data in the html document proper. The root element of the document must contain a declaration specifying the "XML namespace" (xmlns). Including the "XML language" declaration (xml:lang) is "strongly suggested." So is using the deprecated "lang" attribute, for "backward compatibility" with old browsers.
  lang="en">
<head> 
  <title> </title>
</head>
<body>
</body>

</html>
<head>
  <title> </title>
</head>
The head tags contain instructions for web browsers and "behind-the-scenes" internet applications, e.g., search-engine robots; head data is not displayed on the web page itself. Only the document title must be contained inside the head element, but other elements usually appear, including tags that define metalinkstyle, andscript elements.

EXAMPLE:
<head>
  <title>
Ed's Guide to XHTML</title> 

<meta http-equiv="Content-Type"
  content="text/html; charset=ISO-8859-1" />
 

  <link rel="stylesheet"
    type="text/css"
    href="class.css" /> 

  <script type="text/javascript"
   src="
 class.js">
  </script>
</head>

<title> </title>The title is the one required element that falls inside the head element. This title shows up in the browser's title bar, and is used by the browser if the page is bookmarked.
<meta />The meta element is used primarily to provide instructions to the browser or to describe the content of the web page for indexing. It appears only within the head of the html file, but may be repeated as many times as needed. Each meta tag will have at least two attributes: one to identify the function of the tag, and the other to provide the "content."

Choose the first attribute(s) from among:
http-equiv="?"
This provides protocol instructions to the browser. Choices for the missing value ("?") include: Content-Typeexpires,refresh, or set-cookie.
name="?"
This defines the nature of the "content" that follows. The missing value might be authordescriptionkeywords, orrevised, but there are many other possibilities. [NOTE: Use of the name attribute within the meta element remains valid in XHTML; in other tags it has been deprecated in favor of the id attribute.]
scheme="?"
This allows you to provide clarification for meta content information that might be misinterpreted.
The final attribute always take the form:
content="?"
EXAMPLES:
<meta http-equiv="Content-Type"
  content="text/html; charset=ISO-8859-1" />

<meta name="keywords"
  content="
html,xhtml,markup language" />

<meta scheme="
day-month-year
  name="
revised
  content="
09-12-2001" />
NOTE: The first example defines the "character set" (basically, the alphabet and punctuation marks) that the browser should use, so this particular meta element should always be included.
The self-closing link tag creates a connection with another document, especially with an external "style sheet" that specifies how defined elements should be displayed. It appears only in the head, but may be repeated as many times as needed. Among the possible attributes, those for "relationship," "type," and "hypertext reference" (which specifies the URL of the linked document) are the most used. EXAMPLE:
<link rel="stylesheet"
  type="text/css"
  href="
name.css" />
<style type="text/css">
selector1 property: value }
selector2 property: value ; property: value }
</style>
The style element is the place to create an "internal" style sheet, an important part of a prescribed system called Cascading Style Sheets (CSS). 

Unfortunately, there are compatibility problems with coding for this element among past, present, and future browsers, so the best solution is: DON'T USE THIS TAG! At least for the time being. 

Instead, use the link tag to an "external" style sheet, and apply "inline" stylistic features (using the style, class, and id attributes) directly to tags within the body of the document.
<script type="?"> </script>Putting scripts in XHTML that were originally formulated for the old HTML encoding is problematic. The problem is that JavaScript typically makes use of characters that exclusively signify tags in XML, namely: the less-than symbol (<), the ampersand (&), and the character string:
]]>
The "tag" function can be overridden by encapsulating the script in a "CDATA" element:
<![CDATA[ ... ]]>
But, the CDATA tag confuses many current browsers, so the best solution is to put your JavaScripts in a separate document (created in Notepad and saved with the filename exension: .js), and then refer to it with a "system resource controller" attribute (src).
EXAMPLE:
  <script type="text/javascript"
   src="
class.js">
  </script>
</head>
(NOTE: The language="javascript" attribute should no longer be used, even though you will probably see it all over the web. Also, even though the script tags are "empty" as used here, you should still use the opening and closing tag pair rather than turning it into a self-closing tag.)
<body></body>Opening and closing body tags enclose all the content that actually appears on the web page The body may include graphical and audio-visual elements in addition to text.

No comments:

Post a Comment

Beginner's Guide to HTML ADDITIONAL PAGES : Approved Properties and Values (CSS Reference) Basic Tags for Text Markup Cha...