Search Helium

Home > Computers & Technology > Internet > Web Design

XHTML element basics

by Chrys

Created on: March 07, 2009   Last Updated: March 10, 2009

XHTML Elements for Beginners XHTML Basics - Part 2 Introduction This is the second part of my series, XHTML Basics. In this part of the series, I explain what XHTML elements are and how you code (type) them. Elements are tags and their contents, as we shall see below.

Two main Sections There are two main sections of an XHTML documents. The first section is the Head, and the second section is the Body. Let us look at the simple XHTML web page again. Here is the code:

<?xml version="1.0" encoding="UTF-8"?> <!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> <title> Simple </title> </head> <body> Hello World! </body> </html>

The Head section is enclosed in the tags, <head> </head>. The Body section is enclosed in the tags, <body> </body>. Almost everything that you have for the XHTML document goes either in between the body tags or in between the head tags.

The BODY element consists of the Body tags and what goes in between its tags. The HEAD element consists of the Head tags and what goes in between its tags.

Look at the code above again and you will notice that there is the start TITLE tag and the end TITLE tag. What goes in between these tags appear at the title bar of the browser, when the page having the title is displayed. The TITLE element consists of the title tags and what goes in between its tags.

Element Content Only tags that occur in pairs have contents. The Element Content is what goes in between the pair of tags. A single tag element (see later) is an element with one tag; this does not have content.

The content of the TITLE element above is:

Simple

The content of the HEAD element is:

<title> Simple </title>

The content of the BODY element is;

Hello World!

Whatever, you see at your browser is in the Body element. With the exception the TITLE all what is in the Head element is not seen by the user at the browser. The Head element has information on what is useful for the web page document and not the user who views the web page.

Code Wrapping Look at the simple web page code above again. You can type the first line like this:

<?xml version="1.0" encoding="UTF-8"?>

as in the code already, or like this:

<?xml version="1.0" encoding="UTF-8"?>

Note that the tag here is in two lines on this page. Actually, you can type any tag in several

Below are the top articles rated and ranked by Helium members on:

XHTML element basics

Helium Debate

Cast your vote!

Are website designers highly paid?

Click for your side.

87017

Featured Partner

Pacific Research Institute (PRI)

The mission of the Pacific Research Institute (PRI) is to champion freedom, opportunity and personal responsibility for all individuals by advancing free-market policy solutions. It is vital that policy responses are guided by the princ...more


CONNECT WITH US

Read
our blog
Helum for writers

Write and get published
Share with other writers
Polish your freelancing skills

Join our active writing community
Helium Content Source for Publishers

Quality articles from proven freelancers
Exclusive rights, fast turnaround
Brand engagement, business blogging -- our writers do it all

Get custom content today!

INFORMATION


Helium, Inc.
200 Brickstone Square Andover, MA 01810 USA
#