Formatting Text and Nesting Tags
There are many HTML elements that can be used to format text, such as headings, paragraphs, lists, and more. These elements can be nested inside one another to create more complex structures.
Here are some common elements for formatting text in HTML:
<h1>
to<h6>
: Heading elements, which are used to create headings of different levels.<h1>
is the highest level heading, and<h6>
is the lowest.<p>
: Paragraph element, which is used to create a paragraph of text.<em>
: Emphasis element, which is used to emphasize a piece of text.<strong>
: Strong element, which is used to make a piece of text bold.<br>
: Line break element, which is used to create a new line in the text.<blockquote>
: Blockquote element, which is used to create a block of text that is quoted from another source.<ul>
,<ol>
, and<li>
: Unordered list, ordered list, and list item elements, which are used to create lists of items.
Here is an example of how these elements could be used in an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to my website!</h1>
<p>This is my personal website, where I post my thoughts and ideas.</p>
<h2>My favorite things</h2>
<ul>
<li>Cats</li>
<li>Hiking</li>
<li>Reading</li>
</ul>
<h2>A quote I like</h2>
<blockquote>
<p>"The purpose of life is not to be happy. It is to be useful, to be honorable, to be compassionate, to have it make some difference that you have lived and lived well."</p>
<p>- Ralph Waldo Emerson</p>
</blockquote>
</body>
</html>