The Basics Elements and Tags are the basics of any webpage.
Elements Elements are made up of two tags; a start tag and an end tag. Between these tags is the element content. Welcome to My World
Start Tags A start tag is a left angle bracket followed by the name of the element and then a right angle bracket.
End Tags End tags are a left angle bracket and a slash followed by the name of the element and then a right angle bracket. The slash allows the computer to distinguish the end tag from the start tag. Tags are case sensitive – use lower case letters only.
Empty Elements Certain elements are empty and are designated by a slash before the right angle bracket in the start tag. The element is used to insert a line break into the document. This tells the computer to stop the text at that point and start a new line. As you may have guessed the element does not have any content so it does not need an end tag.
Content Most elements will contain multiple elements. This may sound confusing but it is really very simple. An element that contains another element looks like this: The document title
Nesting Nesting means the way in which elements contain elements. When we say that elements are properly nested we mean that each element is completely contained within the elements that contain it, and it completely contains the elements it contains.
Nesting, continued Peeps is a fantastic story. ^ That is perfect XHTML Peeps is a fantastic story. ^ That is not! Can you spot the error? The starts outside the but finishes inside it. The tags are not properly nested.
Required Elements There are four elements that all XHTML documents must contain. They must have a and they must contain a. They also must have and elements.
The element contains the whole document. It starts first and finishes last. It tells the computer that this is an document and must always be present.
The contains elements that are about the document rather than elements that are displayed in the page itself and includes things like the document title.
The document you must have a which describes what the document is. Without a the document is not valid.
A last, but certainly not least, the document must have a. The is the Webpage itself. It comes after the and is the only other element that can go in your element. Anything that you want to put in your page goes in here.
The End This is in fact not really the end, but it is the end of the basics. We have seen that there are rules to be followed when writing your XHTML documents, and we've looked at the basic building blocks of XHTML. As long as you follow these rules, you are on your way to creating XHTML web pages.