HTML Course / Tutorial - Lesson 2: Attributes
In this lesson you are making an HTML-page yourself, and you learn what attributes are. This lesson is a bit few theory, as we did that previous lesson already. This lesson is a bit more practise.
Making an HTML-page yourself
We are now going to make an HTML-page yourself. For now, we just do that with Notepad for Windows.
- Open Notepad (Menu Start → All Programs → Accessoires → Notepad)
- Now type the following HTML-code: (just copy and paste)
<html>
<head>
<title>Title of the website</title>
</head>
<body>
Contents and text of the website.
</body>
</html>
Of course, you can type for Title of the website and Contents and text of the website. something else as well. It should look like this:
-
Save the file as an HTML-file, somewhere where you can find it later (for example C:\Website\site.html): File → Save As..., and choose at Save as type: for All Files (*.*) instead of Text Documents (*.txt), and be sure the filename ends with .html (for example site.html). Here you see an example:
-
Load the website in your browser (for example Internet Explorer, or Firefox) by navigating to the file you just saved (for example C:\Website\site.html).
Congratulations, you've just made your firts HTML-file!
Attributes
You now know how to make an HTML-file, we are going to look what
attributes are now. An attributes gives extra information about a tag. Here you see an example:
<html>
<head>
<title>Title of the website</title>
</head>
<body bgcolor="red" text="yellow">
Contents and text of the website.
</body>
</html>
(click here to view this example)
Here the
<body>-tag has attributes. As you see, every attribute is placed directly after the tag, and are the attributes seperated by a space, and is every attribute of the form
attribute="value". In the example, there were 2 attributes:
bgcolor (backgroundcolor) and
text (textcolor). For those who didn't view the example, the backgroundcolor was thus red, and the textcolor yellow. Of course, you can change that colors.
The
<body>-tag has a lot of more attributes, but they'll come later. Also, there are a lot of more tags that support attributes, but you'll get them later.
You are now able to create an HTML-page. In the next lesson, you learn some more tags to decorate text, so the text will be nicer and more attractive to read.
⇒ Go on with Lesson 3: Text Decoration
← Go back to Lesson 1: Introduction
↵ Go back to the HTML-course
Was this information useful?
If so, please consider linking to this website:
Thank you!