CSS3选择器之:nth-child(n)

      第一次用到这个选择器还是为了解决下面了的问题:

      手机的前端,我们使用了mint-ui,里面有一个日期选择控件,但是选择的时候没有提供年月的选择器,如:

      

      而是提供了下面的方式:

      

      为了达到上面的效果,使用了一个讨巧的方法,用CSS3的选择器:nth-child(n),直接让第3个(天数)元素隐藏掉。 

1  .picker-slot.picker-slot-center:nth-child(3){
2     display: none;
3   }

      参考文档:

      http://www.w3school.com.cn/cssref/css_selectors.asp

      http://www.w3school.com.cn/cssref/selector_nth-child.asp

      https://zhidao.baidu.com/question/2117823454569545467.html

原文地址:https://www.cnblogs.com/gudi/p/8031282.html