Asked in
Computer Terminology
Web Design and Publishing
CSS Cascading Style Sheets

What is the difference between the Div and Span tag?

Answer

User Avatar
Wiki User
May 19, 2016 11:52AM

A div is a block element. This means that if you use a div, unless you float objects next to it using CSS, the div will be alone on a line. A span is an inline element. This means that unless you use line breaks next to it or change it to a block element using CSS, the span will be on the same line as whatever is next or before to it in the code.

For example:

This is a

<div>element</div>

text is above and below but not beside

This is a <span>element</span>, text is before and after on the same line.