HTML Part 2
HTML Part 2
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>.
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.
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.
1.
2.
3.
4.
6.
So, the full element looks like this: <p>My cat is very grumpy</p>
Let’s try creating a simple HTML element. You can italicize the text by wrapping it
with the <em> tags. Here’s how:
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.
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.