[英]applying styles to lists in CSS
I have a list: 我有一个清单:
<li> one </li> <li> two </li> <li> three </li>
how can i call out a specific element in the list to apply a style to? <li> one </li> <li> two </li> <li> three </li>
我如何调出列表中的特定元素来应用样式? for example: how can i call "two" can apply a style to it. 例如:我如何称呼“两个”可以为其应用样式。
用于无序列表的第二个元素的CSS选择器将是
ul>li:nth-child(2)
$('li:eq(1)');
is the jQuery selector for the second element (note: zero based index). 是第二个元素的jQuery选择器(注意:从零开始的索引)。 If you want to use a variable for the element number, then use something like @Soufiane
$('li').eq(num);
如果要为元素编号使用变量,请使用类似@Soufiane
$('li').eq(num);
的元素$('li').eq(num);
in CSS you can try li + li
and you'll get IE7+ support. 在CSS中,您可以尝试
li + li
然后您将获得IE7 +支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.