hacker Posted March 13, 2011 Share Posted March 13, 2011 will anyone tell me the difference between <span></span> & <p></p> ?what is the use of <span></span> ? Link to comment Share on other sites More sharing options...
chrisbrow Posted March 13, 2011 Share Posted March 13, 2011 will anyone tell me the difference between <span></span> & <p></p> ?what is the use of <span></span> ?There are two types of elements in HTML block, and in-line <span> is an in-line element. There is spacing no around this element. Span is closest compared to <div> rather them <p> "p and div" are both block elements. Link to comment Share on other sites More sharing options...
thescientist Posted March 13, 2011 Share Posted March 13, 2011 There are two types of elements in HTML block, and in-line <span> is an in-line element. There is spacing no around this element. Span is closest compared to <div> rather them <p> "p and div" are both block elements.um, you are right that <span> is an inline element, but you are wrong in comparing <span> to a <div>. <div> and <p> both behave the same because they are block level elements. <span> would better be associated with <a> since they are both inline elements by default. Link to comment Share on other sites More sharing options...
jeffman Posted March 13, 2011 Share Posted March 13, 2011 It might be better to say that a span is the inline counterpart of a div. There are two reasons for this.1. Both are semantically neutral. They function as containers only without suggesting anything about their content.2. Apart from their default display rules, they are devoid of any style. This makes them useful as basic containers. Link to comment Share on other sites More sharing options...
thescientist Posted March 13, 2011 Share Posted March 13, 2011 ah, in that context yes, I am inclined to agree. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.