What is a <div> tag?

Experience Level: Junior
Tags: HTML

Answer

The <div> tag is a container that encapsulates other page elements.

It is great for grouping elements and styling them. The <div> tag can be completely invisible or can have borders and different background color. It can have margin and padding and is great for creating panels.

Example
<div>
    <h2>
        BetterCoder.io
    </h2>
</div>

Comments

No Comments Yet.
Be the first to tell us what you think.
HTML for beginners
HTML for beginners

Are you learning HTML ? Try our test we designed to help you progress faster.

Test yourself