Difference between Div and Span tag

To differentiate the Span and Div tag, the following points might be really useful.

  • the difference is that div is an block level tag. Where as the span tag is an inline element and the span is usually nested inside an block level element.

    <div id=”something”>
    <p> This is the difference between <span class=”diff”> div and span tag </span></p>
    </div>

  • Div tag can include other elements but the span tag can only include elements of its level like <a>, the span tag can’t include complex elements.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s