Skip to main content
Practice

body Tag

The <body> tag contains the actual content to be displayed on a web page.

All web content that interacts with the user should be placed within the body tag.


Main Elements of Body

You can enrich your web page by including various elements within the body tag.


Text Elements

Tags used to display text content on a web page.

  • <h1>, <h2> ... <h6>: These tags represent headings or subheadings.

  • <p>: This tag represents a paragraph.

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

Images, Videos, Audio

  • <img>: Tag for displaying images

  • <video>: Tag for displaying videos

  • <audio>: Tag for displaying 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

Used to create ordered or unordered lists.

  • <ul>: Unordered List

  • <ol>: Ordered List

  • <li>: List Item within the list

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

  • <a>: Creates hyperlinks to navigate to other pages or websites.
a tag
<body>
<a href="https://www.example.com">Visit example.com</a>
</body>

Practice

Follow the highlighted portions of the code and try to input them yourself.

Want to learn more?

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