Home Tutorials HTML Tutorial div Element
div Element

div Element


21. div Element

The <div> element is a generic block container used to group content. It is commonly used with CSS and JavaScript.

Syntax

<div>Content</div>

Example

<div>
    <h2>Course Title</h2>
    <p>HTML fundamentals.</p>
</div>

Output

A grouped section appears containing a heading and a paragraph.
Example

🏋️ Test Yourself With Exercises

Take our quiz on div Element to test your knowledge.

Browse Quizzes »