When you plan and design your Web site you intend the content to be displayed in the format of your choice. XHTML elements help facilitate the design of the content on the page. Understanding the basic elements involved in XHTML will ensure that you get the design you planned.
- XHTML features - Elements or tags in XHTML are always typed in small letters or lower case. The symbols less than (<) and greater than (>) are used to enclose the XHTML elements. Ids and values are the main parts of a tag as you will see in this example for a link to another page on the Web, <a href="http://www.amazon.com/">, where the id of the tag is href and the value or attribute is the URL of the page or Web site we are linking to. But this element is not complete without an anchor text which will appear on the page to describe or give an instruction that the viewer can click to go to that particular page or site. So to complete the code we type in <a href="http://www.amazon.com/">Click here</a> where the elements in the first example is completed with an anchor text and the closing tag. Closing tags are written the same way as the beginning tag or element but adding a / (slash) before the tag symbolizing the closure of that particular tag.
- Nesting elements - You can have more than one element within another element in XHTML, for example making the text "Strong" bold and italic will be typed as <b><i>Strong</i></b> and will produce this result Strong. If you notice the way the tags were placed you will see that the element we started with is the very last one closed and we close the succeeding tags inside the same way. Make sure to check all the elements and that they are closed in the right procedure and always with the closing tags.
- How paragraphs are displayed - In XHTML the tag <p> begins a paragraph and you can have several elements within the <p></p> tag to format the content within it. The content within the paragraph tags will automatically wrap itself to the width of the frame or space it is written in so there is no need to force it to begin again on a next line, unless it is your intention to make it jump to the next line. Pressing the Enter key on your keyboard will not affect the text you are writing unless you use the empty element <br/> which forces the text line to stop and begin on the next line.
It is important to learn the basic XHTML elements to organize the content the way you want on the Web site. It will also make it easier for you to go back and make changes to elements in the future.