使用 <br>
标签放在 <a>
或 <span>
内是没有问题的。根据HTML 4.01规范,这是完全有效的。
编辑: <li>
可以包含 <p>
、<br>
和几乎任何其他元素。
该规范有点难以阅读,但基本上它说:
LI
可以包含 block
或 inline
block
由 P
+ 其他一些东西组成inline
由 special
+ 其他一些东西组成special
由 A
+ BR
+ 其他一些东西组成关于 <a>
,它说:
A
可以包含除了 A
的 inline
inline
... 见上面 <li><a href="">List item
<span>
<span>words words words that are "paragraph" 1 of List item</span>
<span>different words that make up "paragraph" 2 of List item</span>
</span></a></li>
在你的 CSS 中:
#rightlist span span {display:block;margin:...}
注意:你声明的任何关于#rightlist span
的内容都会适用于#rightlist span span
,因此你可能需要覆盖#rightlist span span
中的一些规则。
为什么它是“错误”的?
你的br标签可能应该编码为:
<br />
<span>
<p>words words words that are "paragraph" 1 of List item</p>
<p>different words that make up "paragraph" 2 of List item</p>
</span>