| Author |
when should i use span when should I use div
|
Wilson Mui
Ranch Hand
Joined: Apr 09, 2003
Posts: 140
|
|
|
I am only starting to learn javascripts, and html for that matter. I am using almost exlusively div tags, and I was just wondering when people use span and how do they differ? How do you take advantage of the differences. Is there some things you can do with div and not span and vice-versa? thanks for the info.
|
 |
Fred Vaughn
Greenhorn
Joined: Mar 14, 2004
Posts: 5
|
|
There is technically no difference between the two in terms of scripting them by the means of JavaScript. If, however, you compare them in terms of how they render in the browser and the default CSS in which is applied to them, that's a different story. The <div> element is a block-level element meaning it sits on its own line; the <span> element, however, is an inline-level element meaning it doesn't sit on its own line and can sit next to other fellow inline-level elements. So, to sum things up: there is only a difference in how they render. When accessing them via JavaScript, there really is no difference. [ March 14, 2004: Message edited by: Fred Vaughn ]
|
 |
 |
|
|
subject: when should i use span when should I use div
|
|
|