读书人

Is “lt;div/gt;” different from “lt;spa

发布时间: 2012-10-12 10:17:04 作者: rapoo

Is “<div/>” different from “<span style=”display:block“/>” ?
http://stackoverflow.com/questions/1142104/is-div-different-from-span-style-displayblock

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.

然后:

http://www.w3schools.com/tags/tag_div.asp
http://www.w3schools.com/tags/tag_span.asp
1 楼 Hooopo 2011-05-20 我记得我有一次写<div />页面布局出问题了。改成<div>xxx</div>好了。

读书人网 >Web前端

热点推荐