HTML div

<div> tag

The HTML <div> tag is an block level element and it represents a section or content within an HTML document.

The <div> tag enables you to group sections of HTML elements together and format them with CSS.

It can have any type of html elements (table,links, image, div and etc..).

In default this will start a new line.

Syntax

Example 1 - Simple

Try Yourself

Example 2 - HTML elements inside the <div> tag

Try Yourself

Example 3 - Simple usage of <div> tag with css

Try Yourself

Do you feel the above example is difficult? leave it! you will learn css in the future chapter.

Example 4 - Simple usage of <div> tag with javascript

Try Yourself

Do you feel the above example is difficult? leave it! you will learn JavaScript in the future chapter.