【发布时间】:2012-04-18 02:45:47
【问题描述】:
目前,这个example 显示了一个包含 8 个列表项的无序列表。
有没有办法只使用 CSS(没有 HTML 或 JavaScript)在第 4 个 li 项目之后插入一个中断。比如:
ul li:nth-child(4n):after {
content = '<br>';
}
【问题讨论】:
标签: html css dom html-lists
目前,这个example 显示了一个包含 8 个列表项的无序列表。
有没有办法只使用 CSS(没有 HTML 或 JavaScript)在第 4 个 li 项目之后插入一个中断。比如:
ul li:nth-child(4n):after {
content = '<br>';
}
【问题讨论】:
标签: html css dom html-lists
在其后添加一个块元素:http://jsfiddle.net/M4aV3/1/
ul li:nth-child(4n):after {
content: ' ';
display: block;
}
【讨论】:
你也可以使用换行符:
li:nth-child(4n):after {
content: '\a';
white-space: pre;
}
【讨论】: