Welcome to How2Code

In this lesson, we will:

  • Learn basic xhtml tags
  • Build our first webpage

Let's get started:

XHTML tags, as we learned in the previous lesson have a beginning and an end. Some tags, however have both in the start tag. For example:

<tag attribute="something" />

As you can see, a tag that has no content can be ended by putting a slash at the end of the start tag. This removes the need for an end tag.

A list of basic tags

<h1><h2><h3><h4><h5><h6>
<p><div><html><head><body><title>
<br><hr><table><tr><td>

Each of these tags has a specific function. For example, in the top row, you can see the heading tags. These allow you to make bigger text on your page, but should only be used as the start of a section, not just to make text bigger. Think of it as an outline generator, h1 being the root element and h6 being the lowest element possible.

In the second and third rows, I have written some assorted tags that you can't make a good webpage without the knowledge of. From the left, there is the paragraph tag, the division tag, and the four basic structural tags that every webpage needs.

Moving down a row, there is the line break tag, the horizontal rule tag, and the three basic table tags.

It would be a good idea go to w3schools.com and bookmark the XHTML tag list.

Building your first webpage

This is the time you've been waiting for, the first time you get to make the tags do something! Copy the following code into a plain text editor like notepad and let's get to work!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title></title>
 </head>
 <body>

 </body>
</html>

This code is the base for every document we are going to write. Here are the steps to make your first webpage:

  1. Assuming you already have the text copied to your plain text editor (not Microsoft Word), you need to make a title for your page. Add some text between the <title> and </title> tags that represents your webpage. I'm using the text "My first webpage".
  2. Now, the page just needs content. Make a few paragraph tags and put some content in them.
  3. That's all there is to it! You have successfully created a webpage (even though it's not very shiny)!

See you next time!

How2Code was filmed before an emulated sabayon linux computer. No actual computers were harmed in the making of this webpage. How2Code is powered by electricity and the food that Ben ate while he was thinking about what he should write. Do not eat this. It doesn't taste good. Viewer discretion is two words.

This is Ben, signing off. See you next time!

Go back to the table of contents