Resolved Question
What are differences between DIV and SPAN?
 
Details: DIV is used to select a block of text so that one can apply styles to it. SPAN is used to select inline text and let users to apply styles to it. The main difference between DIV and SPAN is SPAN does not do formatting by itself. Also the DIV tag is used as a paragraph break as it creates a logical division of the document in which it is applied. This is in contrast to the SPAN as SPAN simply dos the functionality of applying the style and alignment whatever was specified in it. DIV has ALIGN attribute in it which is not present in case of SPAN. Thus DIV is used in cases where one wants to apply styles to a block of text. But there may be situations in which there might not be clear well structured block of text to work with. In those cases one can opt to apply SPAN which is used to apply styles inline. That is in other words DIV is generally used for block of text and SPAN is generally used for words or sentences.
  asked by: silveryayu  on: Feb 27, 2009  
 Best Answer ! ! !
maxpwnge 's Answer  ( this answer is maked as best answer of this question at: Mar 8, 2009 )


DIV is a HTML tag in advance. Genarally we use table & div tag for the loyout.  If we use table tag, the site will take lot of time to load, but use of DIV tag is quick & Advance.  Especially in search engine, we should use Div tag to load easy. It has attributes, position and all other feature like table tag. Nowadays everybody prefers DIV tag for quick loading.

Whereas, SPAN is a like sub tag (my own language) to apply styles for the specified text, bg and whatever it may. it is applicable only for the specified content in-between the SPAN tag.  we can use it for highlight some text, to fix extra space for any other text or content like.

Hope u'll understand. 
1 comments  answered on: Mar 6, 2009 
Other Answer (4)

here

DIV and Span is using same purpose but the syntax is different

we are using both for hiding the content.

  lambo_san   answered on£ºMar 1, 2009  0 comments


Suppose if you use div tag for a single line in a big paragraph it will give the space before and after the div tag line. If you use span then it does not give any space.

For example you have a paragraph. In that paragraph third line you have a word "geekinterview". So you want to highlight the word and also use CSS class.

In the above situation if you use <div class "ssss".....You can see the space between the lines. but if you use <span class "ssss"....You can't see the space. So it is best to use span when you want to apply some style for a single line.

There is no align property in span tag. At that time you need to use div tag.
  allaboutyou   answered on£ºMar 3, 2009  0 comments

DIV is a HTML tag in advance. Genarally we use table & div tag for the loyout. If we use table tag the site will take lot of time to load but use of DIV tag is quick & Advance. Especially in search engine we should use Div tag to load easy. It has attributes position and all other feature like table tag. Nowadays everybody prefers DIV tag for quick loading.

Whereas SPAN is a like sub tag (my own language) to apply styles for the specified text bg and whatever it may. it is applicable only for the specified content in-between the SPAN tag. we can use it for highlight some text to fix extra space for any other text or content like.

Hope u'll understand.
  ichigolover   answered on£ºMar 4, 2009  0 comments

Div is a Container where we can place our data image text or anything and span is used for formating.
  lanceg   answered on£ºMar 6, 2009  0 comments

Hot Questions

Contact Us - IT-Interview