css3 first-of-type不起作用

时间:2016-09-28 13:44:03

标签: html5 css3 sass

大家好,我在sass中遇到了第一个类型的问题我不知道为什么如果nth-of-type(2n)工作它不会工作。欢迎任何建议

/ *这个代码我需要但它不会工作* /

.menu-parts {

        float: left;

            &:first-of-type {
                ul>li:first-of-type {
                    background-color: red;
                }
            }
      }

/ *这段代码有效,但我不会这样* /

.menu-parts {

        float: left;

            &:nth-of-type(2n) {
                ul>li:first-of-type {
                    background-color: red;
                }
            }
      }



  <div class="menu-parts">

              <?php
                wp_nav_menu( array( 

                  'theme_location' => 'part_one',
                  'container' => false,
                  'menu_class' => 'nav_one'

                ));
                ?>

            </div>

            <div class="menu-parts">
              <ul>
                <li><a href=""><i class="fa fa-pencil-square-o" aria-hidden="true"></i> references</a></li>
                <li><a href=""><i class="fa fa-male" aria-hidden="true"></i> about me</a></li>
                <li><a href=""><i class="fa fa-wrench" aria-hidden="true"></i> abilities</a></li>
              </ul>
            </div>

0 个答案:

没有答案