Table of Contents
- Hello World!
- Understanding Tags and Structure
- Whitespace in XHTML
- Breakdown of a Tag
- Attributes
- Paragraphs and Line Breaks
- Validation and Browser Tools
Basic Structure
Understanding Tags and Structure
So, you've now created your first webpage. Lets take a look at what we've actually created.
You wrote this into an html document:
Your First Webpage:
<html> <head> <title>My First Webpage</title> </head> <body> Hello World! </body> </html>
And when you opened it in a web browser, you got this:
Your First Webpage:
What happened to everything else? What are the words inside the angley brackets?
The XHTML Tag
The words inside the angley brackets are called tags. The webpage you just created uses the following tags: <html>, <head>, <title>, and <body>. The reason you don't see a tag when you open it in your browser is because tags are instructions to your browser. Tags do many things, including change font and colors, add hyperlinks, images, and much more.
You browser needs to know where instructions end. Therefore, all tags must be closed. The tags with the slashes before them, e.g. </html>, are closing tags. They tell your browser where to stop the specified instruction.
Lets quickly review the tag:
- All tags are delineated by angle brackets, < and >.
- Tags are invisible to the user, only the browser (and not the user) "sees" them.
- All tags must end. A tag with a slash in front of it ends the effect of the previous tag. (Some tags self close, we will encounter one of these soon.)
Definitions of the four tags we've used:
-
<html>: "Here begins an HTML document."All well-formed HTML documents have one
<html>and one</html>tag. These tags, along with the.htmlfile extension, identify a file as an HTML document. -
<head>: "Here begins the header."The header contains tags that apply to the overall document. For example, it might contain tags that are designed for search engines to pick up: keywords, a short description, and so on. Information in the header is not meant to be directly displayed as normal webpage content.
Don't worry about the header now. All you need to know at the moment is that
<title>must be within it. -
<title>: "Here begins the document title." (Must be in the header)Along the very top of your browser window, you should see the words, "My First Webpage". These words appear because of the
<title>tag.When a search engine indexes your page, it will probably use the
<title>as the page title it displays to users. If you omit the<title>, the search engine will make up one for you. This is Not a Good Thing. -
<body>: "Here begins the body."All well-formed HTML documents have one
<body>and one</body>tag. This section is where you put all the text and tags that should be displayed in the main browser window. Thus, "Hello World!" is displayed in the main window of the browser.
