Blog

Share this blog : twitter

Feb 4

Written by: IOTAP ::-- Creative Designers Team
2/4/2010 4:26 PM 

The main difference between DIV and SPAN is, SPAN does not do formatting by itself whereas DIV does that.

 

DIV tags are block elements that allow us  to position elements

SPAN tags are inline elements

DIV tags creates some space around itself. It create line breaks. That is it act like a <P> tag

SPAN tags doesn’t create any unwanted space around it. It takes the actual space of the element.

 

The below example explains the actual difference between the DIV and SPAN tag:

1(a).<DIV style=”display:inline”>Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</DIV>

1(b). <SPAN>Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</SPAN>

 

2(a).<DIV>Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</DIV>

2(b).<SPAN style=”display:block”>Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</SPAN>

The state 1(a) & 1(b) will provide the same output and state 2(a) & 2(b) will provide the same output .

 

Cheers,

Kumz

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 


 
 
 

IOTAP is an IT Consulting and Software Services Company with global delivery centers in Mumbai and Chennai, India. We are a Microsoft Gold Certified Partner and use products and technologies like Dynamics CRM, SharePoint, Silverlight, and the .Net platform to create solutions that help our customers connect, communicate and collaborate effectively