[b][url]http://stackoverflow.com/questions/1142104/is-div-different-from-span-style-displayblock[/url][/b]
[quote="Greg"]Yes they are different.
Even though you style a span with display: block you still can't put block-level elements inside it:
<div><p>correct</p></div>
<span style="display: block;"><p>wrong</p></span>
The (X)HTML still has to obey the (X)HTML DTD (whichever one you use), no matter how the CSS alters things.[/quote]
然后:
[b][url]http://www.w3schools.com/tags/tag_div.asp[/url]
[url]http://www.w3schools.com/tags/tag_span.asp[/url][/b]
[quote="Greg"]Yes they are different.
Even though you style a span with display: block you still can't put block-level elements inside it:
<div><p>correct</p></div>
<span style="display: block;"><p>wrong</p></span>
The (X)HTML still has to obey the (X)HTML DTD (whichever one you use), no matter how the CSS alters things.[/quote]
然后:
[b][url]http://www.w3schools.com/tags/tag_div.asp[/url]
[url]http://www.w3schools.com/tags/tag_span.asp[/url][/b]
本文解释了HTML中DIV与SPAN元素的主要区别,尽管可以通过CSS将SPAN设置为display:block,但SPAN仍不能包含块级元素。文章引用了Stack Overflow上的讨论及W3Schools的相关资料。

被折叠的 条评论
为什么被折叠?



