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

嵌套選擇器內的與號(父選擇器)

Ampersand (parent selector) inside nested selectors(嵌套選擇器內的與號(父選擇器))
本文介紹了嵌套選擇器內的與號(父選擇器)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這不是記錄在案還是不可能?

Is this not documented or just not possible?

#parent {
  #child {
    width: 75%;

    .additional_parent_class & {
      width: 50%;
    }
  }
}

這基本上會變成:

.additional_parent_class #parent #child {
  width: 50%;
}

雖然這很有意義,因為與符號的實現及其使用方式有關.如果我試圖讓它實現這一點怎么辦:

While this makes sense because of the implementation of the ampersand and how it's used. What if I'm trying to get it to achieve this:

#parent.additional_parent_class #child {
  width: 50%;
}

我能夠做到這一點的唯一方法是在子聲明之外編寫另一條規則:

The only way I have been able to achieve this is by writing another rule outside of the child declarations:

#parent{
  #child {
    width: 75%;
  }

  &.additional_parent_class #child {
    width: 50%;
  }
}

雖然在此實現中這不一定是麻煩事",但如果#child 有自己的子項現在需要在兩個規則中復制,這似乎會適得其反.

While this isn't necessarily a 'pain in the butt' in this implementation, it seems counter productive if #child has children of its own that will now need to be duplicated in both rules.

無論如何,也許我只是挑剔,但如果有更多的方法可以遍歷選擇器,那就太好了.

Anyway, maybe I'm just being picky, but it would be great if there were more ways to traverse through the selectors.

推薦答案

雖然目前還不可能,但這個和許多對 & 語法的類似改進計劃在 Sass 3.3 中發布.您可以在這里關注關于 Sass 問題的功能討論.

Although it is not currently possible, this and many similar improvements to the & syntax are slated for release in Sass 3.3. You can follow the discussion about the feature on the Sass issue here.

這篇關于嵌套選擇器內的與號(父選擇器)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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().方法返回的結果是否有序?)
Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯誤:當使用 JS 刪除項目時,first-child 不更新 display:block)
nth-Child CSS selectors(nth-子 CSS 選擇器)
Using same ID for multiple HTML tags?(對多個 HTML 標簽使用相同的 ID?)
主站蜘蛛池模板: 欧美日日夜夜 | 国产成人精品三级麻豆 | 久久精品欧美一区二区三区不卡 | av黄页| 四虎看片 | 四虎久久久 | 美日韩一区二区三区 | 性久久 | 色综合视频在线观看 | 日韩字幕 | 伊人av影院| 国产成人在线免费观看 | 国产欧美在线 | 成年人免费在线视频 | 欧美视频在线观看免费 | 一区在线观看 | 中文字幕在线看片 | 亚洲精品欧美 | 成人在线国产 | 中文字幕av网 | 黄色大片在线免费观看 | 二区三区视频 | a在线免费观看 | 色综合天天综合网天天狠天天 | 国产黄色一区 | 9l视频自拍九色9l视频成人 | 日本欧美久久久久免费播放网 | 午夜精品国产 | 日韩欧美一级片 | 欧美区一区二 | 色站综合| 亚洲一级黄色片 | 波多野结衣一区二区三区在线观看 | 三级黄网站 | 欧美在线免费观看 | 久久午夜视频 | 黄色网址| 中文字幕免费观看 | 婷婷午夜天 | www.四虎在线 | 日本国产视频 |