1
如何個別指定列表元素,比如我想提出:CSS選擇下一個和以前的元素
HTML:
<ul class="roundabout-holder">
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item roundabout-in-focus"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
</ul>
的CSS:
.roundabout-in-focus{
font-size:1em;
}
.roundabout-in-focus.prev(),
.roundabout-in-focus.next(){
font-size:.9em;
}
.roundabout-in-focus.prev().prev(),
.roundabout-in-focus.next().next(){
font-size:.8em;
}
.roundabout-in-focus.prev().prev().prev(),
.roundabout-in-focus.next().next().next(){
font-size:.7em;
}
那意味着離焦點越遠,列表元素的字體大小就越小。