Skip to main content
Crowdfunding
Python + AI for Geeks
Practice

body Tag

The <body> tag contains the content that is actually displayed on the web page.

All web content that interacts with the user must be located inside the body tag.

The following elements can be included inside the <body> tag.


Text Elements

These are the tags used to display textual content on the webpage.

  • <h1>, <h2> ... <h6>: h stands for Heading, and you can express from the largest heading h1 to the smallest heading h6.

  • <p>: A tag that represents a paragraph of text.

Displaying Headings and Paragraphs
<body>
<h1>Welcome!</h1>
<p>This is my first webpage.</p>
</body>

Images, Videos, Audios

To display multimedia content on a webpage, use the following tags.

  • <img>: A tag that displays an image

  • <video>: A tag that displays a video

  • <audio>: A tag that plays audio

img, video, audio Tags
<body>
<img src="myimage.jpg" alt="My Photo" />
<video src="myvideo.mp4" controls></video>
<audio src="mysong.mp3" controls></audio>
</body>

Lists

Displays ordered and unordered lists on the webpage.

  • <ul>: Unordered List

  • <ol>: Ordered List

  • <li>: List Item within a list

ul, li Tags
<body>
<!-- Unordered List -->
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</body>

  • <a>: Creates a hyperlink that allows you to navigate to another page or website.
a Tag
<body>
<a href="https://www.example.com">Go to example.com</a>
</body>

Practice

Follow the highlighted portions of the code and type them in to practice.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.