! Lesson 2 | HTML Learning

Logo Code X Community

Lesson 2: Attributes in the <body> Tag

Let's look at some of the common attributes used with the <body> tag in older HTML to control page appearance.

1. bgcolor

This attribute is used to set the background color of the webpage.

<body bgcolor="lightblue">
<h1>Hello World!</h1>
</body>

2. background

This sets an image as the background of the webpage.

<body background="bg.jpg">
<h1>Welcome!</h1>
</body>

3. text

This defines the default color of all text on the page.

<body text="black">
<p>This is black text.</p>
</body>

4. link

This sets the color of unvisited links.

<body link="blue">
<a href="#">Unvisited Link</a>
</body>

5. alink

This changes the color of a link while it is being clicked (active state).

<body alink="red">
<a href="#">Click Me</a>
</body>

6. vlink

This sets the color of links that have already been visited.

<body vlink="purple">
<a href="#">Visited Link</a>
</body>

Note: These attributes are outdated and have been replaced by CSS in modern HTML, but it's important to learn them for foundational understanding.