Skip to main content

AddToAny

Share/Save

Div Tag vs Span Tag

1 reply [Last post]
Vineet
Vineet's picture
User offline. Last seen 2 years 14 weeks ago. Offline
Joined: 10/21/2009

What is the difference between <div> and <span>.

Div is a block and span is an inline element. Please explain it with an example.

Anonymous
Anonymous's picture
Difference between div and span

Div tag act as a container and it is movable also but span simply contain inline text.
In div tag u can put other html tags span too but in span u can not do this and the css applying is different.

• The primary difference between the and

tags is that doesn't do any formatting of it's own. The
tag acts includes a paragraph break, because it is defining a logical division in the document. The tag simply tells the browser to apply the style rules to whatever is within the .
• a span element is in-line and usually used for a small chunk of in-line HTML