0% found this document useful (0 votes)
2 views2 pages

HTML Part 2

html part 2

Uploaded by

vijaykharb798
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

HTML Part 2

html part 2

Uploaded by

vijaykharb798
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

What is an HTML Element?

An HTML element is a building block of a webpage. It is made up of three main parts:

1. Opening tag: This indicates the start of an element. For example, <p> starts a paragraph.
2. Content: This is the actual information or text that is enclosed by the element. For example,
"My cat is very grumpy" is the content in the paragraph element.
3. Closing tag: This marks the end of the element. For a paragraph, it would be </p>.

Example of a Basic HTML Element

Let’s look at the following line of text:

My cat is very grumpy

We can wrap this text in an HTML element to make it a paragraph by using the <p>
tag:

html
Copy code
<p>My cat is very grumpy</p>

Here, <p> is the opening tag that tells the browser this is a paragraph, and </p> is the
closing tag that marks where the paragraph ends.

HTML Tags and Case Sensitivity

In HTML, tags (like <p>, <h1>, <title>) are not case-sensitive. This means you can
write them in any combination of uppercase or lowercase letters. However, it’s best
practice to write tags in lowercase for consistency and easier readability.

The Anatomy of an HTML Element

Let’s break down the <p> element:

1.

Opening tag: <p>

2.

1. This tells the browser to start a paragraph.

3.

Content: My cat is very grumpy

4.

1. This is the text that appears in the paragraph.


5.

Closing tag: </p>

6.

1. This tells the browser to end the paragraph.

So, the full element looks like this: <p>My cat is very grumpy</p>

Activity: Create Your First HTML Element

Let’s try creating a simple HTML element. You can italicize the text by wrapping it
with the <em> tags. Here’s how:

 Opening tag: <em>


 Closing tag: </em>

For example, if you want to make the word “very” italic, you would write:

html
Copy code
<p>My cat is <em>very</em> grumpy</p>

Nesting Elements

Elements can also be nested inside other elements. For example, if you wanted to
emphasize the word “very,” you could wrap it in the <em> tag, and if you wanted to
make it bold, you could nest it inside the <strong> tag.

Here’s how it would look:

html
Copy code
<p>My cat is <strong><em>very</em></strong> grumpy</p>

This example shows that you can apply multiple formatting styles by nesting different
tags.

You might also like