Ok. Here is the difference. A "DIV" has breaking space. Therefore its actually better to use "SPAN" when you are using it to give style to text, and use "DIV" for more DHTML stuff i.e hide/show layers and things....even though you can actually use "span" for that as well. But that is the difference as far as I know. Hope that was of some help. :-D
Yep, realgaz is right. a DIV breaks meaning that whatever
is after a DIV, it will be below it. A SPAN however does not
break. Try out this example:
<html>
<body>
<span> This text is in a span. </span> This text is after a span. As you can see it doesnt break.
<br><br><br>
<div> This text is in a div. </div> This text is after a
div and is below it.
I hope this helps, BobbaFet
Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
bobbafet and realgaz are right. Despite a span tag's hability to be positionned like a Div a span tag is more for formatting and design then it is for content disposition.
Div's are containers that you use for your page content and spans are there if you want to add style to a part of your document.
Example of usage :
<style>
.boldedRedText
{
font-weight: bold ;
color : red ;
}
</style>
<div style="position:absolute;left:20;top:100;">
This is my <span class=boldedRedText>content</a>
</div>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.