1. Home
  2. Computing & Technology
  3. Web Design / HTML

Basic (X)HTML Tags for a Web Site
Every Site Should Have These Tags

By , About.com Guide

These are the tags required in every Web page. (Note: some are not technically required by the HTML specification, but some browsers will not render correctly without them, so it is always better to leave them in than out - the space you save is not worth the problems you might cause.)

<!DOCTYPE>
The DOCTYPE element is not really an XHTML element, but rather an identifier for the page. In order to create a valid XHTML document, you need to include the DOCTYPE. The DOCTYPE references a DTD, and there are three DTDs you can use:

  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    This is the strict DTD, I wouldn't recommend using this DOCTYPE unless you plan to be very careful with your XHTML
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    This is the transitional DTD; it is the best one to use for most Web sites
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    This is the frameset DTD; if you're going to put up a framed page, you should use this DTD

<html>
The first tag that any Web page must have is the <html> tag. It tells the browser that the following text will be marked up in HTML format, and not some other format such as straight text, SGML, or XML. The closing tag </html> is required and is the last tag in your document.

<head>
The <head> tag is used to define information for the browser that may or may not be displayed to the user. Tags that belong in the <head> section are <title>, <meta>, <script>, and <style>. The closing tag </head> is required.

<title>
The <title> tag belongs in the <head> section of your document. It is the title of your Web page, and is usually displayed by the browser at the top of the browser pane. The closing tag </title> is required.

<body>
The <body> tag is where all your HTML information belongs. It defines the primary portion of your Web page. With attributes of the <body> tag, you can define the background color of your Web pages, the text color, the link color, and the active and visited link colors. The closing tag </body> is required.

A sample Web page would look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
  This is the title of the page.
</title>
</head>
<body>
  The body text goes here.
</body>
</html>

Learn more about these and other tags in the HTML Tag Library.

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. Beginning HTML Tutorials
  6. Basic (X)HTML Tags for a Web Site>

©2009 About.com, a part of The New York Times Company.

All rights reserved.