I am curious, the span tag seems to work the same as a div.
|
The main difference is that the Two block level elements (divs) will be displayed one after each other vertically, whereas two inline elements (spans) will be displayed one after each other horizontally. To understand the difference in visual terms, it might help to think of the |
|||
|
|
|
Both Nick and Toby have answered your question nicely, but to take it one level further. By default, However, bending them to act like one another isn't recommended. And, there are rules in HTML that actually prevent using block-level elements inside of other elements (mostly inline elements like the Try to think of them as semantic elements. Use Having said this, HTML5 has a plethora of semantic elements that should significantly reduce needing to use either of these generic tags. Using semantic tags is highly recommended over adding copious amounts of divs and spans. Good luck! |
||||
|
|
|
The main difference is that Both can be styled using CSS to act however you wish but out of the box you would normally use Some things will affect inline and block elements different, for example you cannot put a height onto a |
|||||
|
protected by Community♦ Feb 27 at 16:15
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.