css :not的多個條件的寫法

來源:互聯網
上載者:User

:not 偽類別選取器可以篩選不符合運算式的元素

例子

table tbody tr:not(:first-child):not(:last-child) td{     text-align: right;}

以上代碼可以選擇table表格中tbody部分非首個、非最後一個的tr,並設定其子項目td文本樣式居右

這裡面需要注意not的文法格式:

單個的not寫法:

/*選中非段落元素*/:not(p){}

多個not的寫法

/*選中div裡面非首個、非最後一個的中間p元素*/div p:not(:first-child):not(:last-child){}


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.