久久久久久久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?)
主站蜘蛛池模板: 请别相信他免费喜剧电影在线观看 | 亚洲黄色片免费观看 | 老司机狠狠爱 | 天天插天天操 | www.亚洲一区二区 | 成年人国产在线观看 | 国产精品久久久乱弄 | 精品视频在线播放 | 国产精品高潮呻吟久久aⅴ码 | 久久a久久 | 成人在线激情 | 国产精品一区二区视频 | a在线免费观看 | 欧美精品在线一区 | 91在线视频观看免费 | 日韩欧美精品 | 成人日b视频 | 怡红院怡春院一级毛片 | 91在线观看视频 | 国产一区二区三区色淫影院 | 国产成人免费视频网站高清观看视频 | 午夜免费视频 | 国产精品www | 国产精品一区二区在线播放 | 国产精品久久久久国产a级 欧美日本韩国一区二区 | 日韩激情在线 | 香蕉久久久 | 成年网站在线观看 | 久久亚洲高清 | 久久久久99 | 久久久精品黄色 | 免费看的黄网站 | 亚洲国产一区二区三区 | 午夜影院在线 | 伊人久久在线观看 | 成人一区二区在线 | 一二区成人影院电影网 | 天天拍天天草 | 欧美成人精品激情在线观看 | 国产成人福利视频 | 欧美一二区 |