What is the difference between div and span?

298 Views Asked by At

there are two tags in html , one is div and another one is span.. now I wish to know the difference between these two tags according to their functions and roles...

I tried both the tag but I didn't found any unique difference between both, so I am expecting to get the detailed answer .

1

There are 1 best solutions below

3
Amank Arya On

Div element defines a section in a document (block-level).

Span elememt also defines a section in a document (inline).

So what's the difference between block-level and inline.

There are two types of elements in html.

Block-Level Elements. Inline Elements. Block-Level Element always starts on a new line and takes up the full width as possible. Inline Elements doesn't starts on a new line and takes up as much width as necessary. You cannot put a block-level elememt into an inline element.

Div is a block-level element and Span is an inline element.