HTML consists of almost 100 tags. Don't let that put you off though - you will probably find that most of the time, you only use a handful of tags on your web pages. Having said that, I highly recommend learning all HTML tags eventually - but we'll get to that later.
OK, lets look more closely at the example that we created in the previous lesson.
Explanation of the above code:
HTML Tutorial ExampleLess than 5 minutes into this HTML tutorial and I've already created my first homepage!
- The element tells the browser which version of HTML the document is using.
- The element can be thought of as a container that all other tags sit inside (except for the !DOCTYPE tag).
tag is an exception to this. The content of the
tag is displayed in the browser's title bar (right at the very top of the browser).
- The tag is the main area for your content. This is where most of your code (and viewable elements) will go.
- The tag declares a paragraph. This contains the body text.
Closing your tagsAs mentioned in a previous lesson, you'll notice that all of these tags have opening and closing tags, and that the content of the tag is placed in between them. There are a few exceptions to this rule.
You'll also notice that the closing tag is slightly different to the opening tag - the closing tag contains a forward slash (
/) after the
<. This tells the browser that this tag closes the previous one.
UPPERCASE or lowercase?Although most browsers will display your page regardless of the case you use, you should always code in lowercase. This helps keep your code XML compliant (but that's another topic).