久久久久久久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?)
主站蜘蛛池模板: va精品| 久久久久久久久精 | 盗摄精品av一区二区三区 | 一区二区三区精品在线 | 激情欧美日韩一区二区 | 亚洲日日操 | 999www视频免费观看 | 91综合在线视频 | 国产在线视频一区二区董小宛性色 | 天天综合国产 | 99精品欧美一区二区三区综合在线 | 999国产精品视频免费 | 欧美一区二区三区在线免费观看 | 欧美一区二区 | 国产福利视频网站 | 欧美成人一区二免费视频软件 | 久久久久久影院 | a黄视频 | 午夜在线视频 | 国产精品久久久久久吹潮 | 成人性视频在线 | 精品国产一区二区国模嫣然 | 国产亚洲精品美女久久久久久久久久 | 亚洲天堂av在线 | 成人精品久久 | 欧美小视频在线观看 | 久久亚洲一区二区三区四区 | 日韩中文不卡 | 欧美日韩中文在线 | 日本a在线 | 亚洲精品成人av久久 | 亚洲一区二区在线播放 | 人人叉| www国产亚洲精品 | 亚洲欧美日韩在线不卡 | 婷婷色在线播放 | 国产在线视频一区 | 国内久久| 在线观看视频一区二区三区 | 日韩一区二区黄色片 | 国产午夜精品久久久久 |