HTML Div Tag

The HTML

tag
is used to group the large section of HTML elements together.

We know that every tag has a specific purpose e.g. p tag is used to specify paragraph,

to

tag are used to specify headings but the
tag is just like a container unit which is used to encapsulate other page elements and divides the HTML documents into sections.

The div tag is generally used by web developers to group HTML elements together and apply CSS styles to many elements at once. For example: If you wrap a set of paragraph elements into a div element so you can take the advantage of CSS styles and apply font style to all paragraphs at once instead of coding the same style for each paragraph element.

Test it Now

Output:

Welcome to tutorialsinfo.com, Here you get tutorials on latest technologies.

This is second paragraph.


Difference between HTML div tag and span tag

div tag span tag
HTML div is a block element. HTML span is an inline element
HTML div element is used to wrap large sections of elements. HTML span element is used to wrap small portion of texts, image etc.

HTML div example: Login Form

In this example, we are creating box using div tag. There is a login form inside the box. Let's see the CSS and HTML code.

CSS Code:

HTML Code:

Test it Now

Output:

Please Login

Email:
Password:


Supporting Browsers

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
Yes Yes Yes Yes Yes
Next TopicHTML em tag




Contact US

Email:[email protected]

HTML div Tag
10/30