body Tag
The <body> tag contains the content that is actually displayed on a web page.
All web content that interacts with the user must be located inside the body tag.
The <body> tag can include elements such as the following:
Text Elements
Tags commonly used to display text content on a webpage are as follows:
-
<h1>,<h2>...<h6>: h stands for Heading, allowing representation from the largest heading h1 to the smallest heading h6. -
<p>: A tag representing a paragraph of text.
<body>
<h1>Welcome!</h1>
<p>This is my first webpage.</p>
</body>
Images, Videos, and Audio
Use the following tags to display multimedia content on a webpage.
-
<img>: Tag for displaying images -
<video>: Tag for displaying videos -
<audio>: Tag for displaying audio
<body>
<img src="myimage.jpg" alt="my photo" />
<video src="myvideo.mp4" controls></video>
<audio src="mysong.mp3" controls></audio>
</body>
Lists
Display ordered or unordered lists on a webpage.
-
<ul>: Unordered List -
<ol>: Ordered List -
<li>: List Item within a list
<body>
<!-- Unordered list -->
<ul>
<li>Apples</li>
<li>Bananas</li>
</ul>
</body>
Links
The <a> tag creates a hyperlink that navigates to other pages or websites.
<body>
<a href="https://www.example.com">Go to example.com</a>
</body>
Practice
Follow the highlighted parts of the code and type them out.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.