我需要在导航元素之间添加分隔符.分隔符是图像.
I need to add separators between elements of navigation. Separators are images.
我的 HTML 结构是这样的:ol >李>一个>img
.
My HTML structure is like: ol > li > a > img
.
这里我提出了两种可能的解决方案:
Here I come to two possible solutions:
li
标签进行分隔(嘘!),li
tags for separation (boo!),怎么办?
只需在li
上使用分隔图作为背景图即可.
Simply use the separator image as a background image on the li
.
要让它只出现在列表项之间,请将图像放在 li
的左侧,但不要放在第一个.
To get it to only appear in between list items, position the image to the left of the li
, but not on the first one.
例如:
#nav li + li {
background:url('seperator.gif') no-repeat top left;
padding-left: 10px
}
此 CSS 将图像添加到跟在另一个列表项之后的每个列表项 - 换句话说,除了第一个之外的所有列表项.
This CSS adds the image to every list item that follows another list item - in other words all of them but the first.
注意.请注意 相邻选择器 (li + li) 在 IE6 中不起作用,因此您只需将背景图像添加到常规 li (使用条件样式表)并可能应用负边距到边缘之一.
NB. Be aware the adjacent selector (li + li) doesn't work in IE6, so you will have to just add the background image to the conventional li (with a conditional stylesheet) and perhaps apply a negative margin to one of the edges.
这篇关于导航分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!