久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

嵌套在 css :not() 選擇器中

nesting inside css :not() selectors(嵌套在 css :not() 選擇器中)
本文介紹了嵌套在 css :not() 選擇器中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

是否可以在 :not 選擇器中包含嵌套值?例如:

Is it possible to have nested values inside the :not selector? For eg:

:not(div > div)

每當(dāng)我嘗試它時,它似乎都不起作用.也許您需要以另一種我還沒有想到的方式使用它?到目前為止,在我看到的所有示例中,您只能在此選擇器中使用一個值.

Whenever I tried it, it does not seem to work. Perhaps you need to use it another way which I have not figured out? So far, in all the examples I see, you can only use one value inside this selector.

推薦答案

:not() 一次只接受一個簡單的選擇器;Selectors 3 規(guī)范中提到了這一點(diǎn):

:not() only accepts one simple selector at a time; this is mentioned in the Selectors 3 spec:

否定偽類 :not(X) 是一個采用 簡單選擇器(不包括否定偽類本身)作為參數(shù).它表示其參數(shù)未表示的元素.

The negation pseudo-class, :not(X), is a functional notation taking a simple selector (excluding the negation pseudo-class itself) as an argument. It represents an element that is not represented by its argument.

您的示例中的簡單選擇器將是您擁有的兩個 div 標(biāo)記.其他簡單的選擇器包括類選擇器、ID 選擇器、屬性選擇器和偽類.它不接受多個簡單的選擇器,也不接受 > 或空格等組合符.

The simple selectors in your example would be the two div tokens that you have. Other simple selectors include class selectors, ID selectors, attribute selectors and pseudo-classes. It does not accept more than one simple selector, nor does it accept combinators like > or space.

根據(jù)您要準(zhǔn)確選擇的元素,可能無法排除 div >div:

Depending on which elements you're trying to select exactly, there may not be a way to exclude div > div:

  • 如果您只想選擇 div 的子元素,而這些元素本身不是 div,請改用:

  • If you only want to select elements that are children of a div, that are themselves not div, use this instead:

div > :not(div)

  • 如果您只想選擇父元素不是 divdiv 元素,請改用:

  • If you only want to select div elements whose parent element is not a div, use this instead:

    :not(div) > div
    

  • 如果你想單獨(dú)使用這個否定,選擇所有個其他元素,那么只使用一個選擇器是沒有辦法的.

    If you want to use this negation by itself, selecting all other elements, then there isn't a way using just a selector.

    我能想到的唯一其他可行的 CSS 解決方法是在沒有 :not() 表達(dá)式的情況下將樣式應(yīng)用于您想要的元素,然后為 div > 撤消它們.div.這適用于您嘗試定位的任何一組元素;缺點(diǎn)是并非所有屬性都可以輕松重置.

    The only other viable workaround in CSS that I can think of is to apply styles to the elements you want without the :not() expression, then undo them for div > div. This works for any set of elements you're trying to target; the disadvantage is that not all properties can be easily reset.

    或者,如果您使用 jQuery,它確實支持 :not(div > div) 與 CSS 版本不同,您可以將選擇器放在腳本中,例如,讓 jQuery 將類名應(yīng)用于那些然后元素在您的 CSS 中定位該類.

    Alternatively, if you're using jQuery, which does support :not(div > div) unlike the CSS version, you can place the selector in a script and, for instance, have jQuery apply a class name to those elements then target that class in your CSS.

    這篇關(guān)于嵌套在 css :not() 選擇器中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

    【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

    相關(guān)文檔推薦

    CSS selector when :target empty(:target 為空時的 CSS 選擇器)
    Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價值嗎?)
    Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的結(jié)果是否有序?)
    Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯誤:當(dāng)使用 JS 刪除項目時,first-child 不更新 display:block)
    nth-Child CSS selectors(nth-子 CSS 選擇器)
    Using same ID for multiple HTML tags?(對多個 HTML 標(biāo)簽使用相同的 ID?)
    主站蜘蛛池模板: 毛片一区二区三区 | 国产亚洲成av人片在线观看桃 | 情侣黄网站免费看 | 欧美一级在线观看 | 91久久久久久久久久久 | 亚洲色欧美另类 | 天天插天天狠天天透 | 91精品国产综合久久香蕉麻豆 | 亚洲国产精品一区二区三区 | 亚洲国产精品成人久久久 | 欧美日韩在线免费观看 | 日韩高清成人 | 黄色网址免费在线观看 | 99久久电影 | 国产丝袜一区二区三区免费视频 | 隔壁老王国产在线精品 | 日韩国产一区二区三区 | 亚洲二区在线观看 | 久久久久久久久久久久一区二区 | 伦理片97| 在线一区| 午夜影院普通用户体验区 | 天堂av中文 | 在线亚洲精品 | 日韩av中文 | 亚洲区一区二区 | 91精品久久久 | 国产精品久久久久久久久久久久 | 亚洲一区二区在线视频 | 国产精品高潮呻吟久久 | 欧美日韩综合一区 | 欧美极品在线播放 | 久久99精品久久久97夜夜嗨 | 午夜小电影 | 男人天堂久久 | 在线日韩视频 | 欧美成年人| 国产福利91精品一区二区三区 | 欧美国产精品一区二区 | 免费黄篇| 男人天堂网av |