Menu
Coddy logo textTech

Divisions

Part of the Fundamentals section of Coddy's HTML journey — lesson 25 of 60.

Imagine you want to break your webpage into blocks to organize your content. In HTML, you can use a div to group elements together. 

div tags are great for creating layouts and separating sections.

Here's the basic syntax:

<div>
	<!-- Content goes here -->
</div>

You can add other HTML elements inside a div, such as paragraphs, headings, images, and even other div elements. 

Here's an example of how to use div tags to create a simple layout with a header, main content area, and footer:

<div>
	<h1>Header</h1>
</div>
<div>
	<p>Main content goes here.</p>
</div>
<div>
	<p>Footer</p>
</div>
challenge icon

Challenge

Easy

Create 3 div elements, placed one after another in your HTML document. 

Inside each div, add a p tag that contains the name of a movie you like.

Cheat sheet

Use div tags to group elements together and organize content into blocks:

<div>
	<!-- Content goes here -->
</div>

You can nest other HTML elements inside a div, including paragraphs, headings, images, and other div elements:

<div>
	<h1>Header</h1>
</div>
<div>
	<p>Main content goes here.</p>
</div>
<div>
	<p>Footer</p>
</div>

Try it yourself

<!DOCTYPE html>
<html>
    <body>
        <!-- Write code here -->
    </body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals