The screenshot below shows all of the necessary elements of an XHTML page.
Use the line numbers in the image for reference.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
These lines contain the Document Type Definition (DTD). The DTD tells the browser what type of markup language a page is using. The DTD is always the first thing in an (X)HTML document.
It's not important to know exactly what everything in this line means just yet, but note the last part of line 2, that says xhtml1-transitional. This means that this particular file is an XHTML 1 document using the transitional ruleset. You can read more about (X)HTML DTDs at the w3schools page on HTML <!DOCTYPE>
Declaration.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
This is the start of the <html>
tag. Everything in an (X)HTML document (other than the DTD) is enclosed by the html tag.
All of the stuff in the middle is the XML Name Space. Once again, it's not important right now to know what all that means, just remember to put it there.
<head>
This is the start of the <head>
tag. The head section is where all of the "information" about the page is stored. Most of the stuff inside this section is not visible in the browser.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
This is a <meta>
tag. There are lots of different types of meta tags. This particular one specifies the character set as utf-8. Once again, it's not right now to know what all that means, just remember to put it there.
<title>XHTML Transitional Template</title>
These are the opening and closing <title>
tags. The text between the two tags, in this case "A Basic XHTML Page", is what will be the title of the page. The title appears at the top of the browser window, and sometimes in the tab.
</head>
This is the end of the head section. Note that this tag has a forward slash ( / ) in it. This indicates that it's a closing tag. Most HTML tags have an opening and closing tag.
<body>
This is the start of the <body>
tag. All of of the actual content of your web page should go between the opening and closing body tags.
</body>
This is the closing <body>
tag.
</html>
This is the closing <html>
tag, signifying the end of the HTML document. It should be the last thing in the document. Notice the forward slash that indicates it's a closing tag.