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

無子但非空的 CSS 選擇器

CSS Selector for No-Children-But-Not-Empty(無子但非空的 CSS 選擇器)
本文介紹了無子但非空的 CSS 選擇器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想在下面的 HTML 片段中選擇 BONKERS.它的區別在于它在 <code> 塊中是單獨的,而它的所有兄弟都包含 <a> 的.:empty 是顯而易見的選擇,但由于文本節點而無法使用.我以為我知道這些東西,但這讓我發瘋了.

I want to select BONKERS in the HTML fragment below. Its distinction is that it's alone in a <code> block whereas all its siblings contain <a>'s. :empty is the obvious choice, but won't work due to the text node. I thought I knew this stuff but this is driving me, well, bonkers.

 <ul class="Reference">
    <li class="level4">
        <code class="active-voice">
            <a href="some/url/x" version="2">
                mauve 
            </a>
    </code>
    <li class="level8">
        <code class="active-voice">
            BONKERS 
        </code>
    </li>
    <li class="level9 subclass">
        <code class="active-voice">
            <a href="some/url/c" version="2">
                cerise 
            </a>
    </code>
    </li>
</ul>

我需要一個純 CSS 解決方案(JS 不是一個選項),并且無法控制源 HTML.

I need a pure CSS solution (JS isn't an option), and have no control over the source HTML.

呸!

推薦答案

你可以按照這個方法.通過您想要的任何 CSS 設置 code 元素的樣式,然后重置那些在 anchor 的樣式中可繼承的 CSS 樣式,即:

You can follow this approach. Style the code elements by whatever CSS you want and then reset those CSS styles which are inheritable in anchor's styles i.e.:

演示:http://jsfiddle.net/GCu2D/1062/

CSS:

code {
    color: green;
    font-weight: bold;
}
code a{
    color: red;/*Reset any inheritable css*/
    font-weight: normal; /*Reset any inheritable css*/
}

您可能不需要重置所有樣式,因為并非所有樣式都由 anchorcode 元素繼承

You might not need to reset all styles because not all styles are inherited by anchor from the code element

這是您真正可以考慮的一種解決方案.

This is one solution which you can really consider.

這篇關于無子但非空的 CSS 選擇器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Style every third element?(每隔三個元素設置樣式?)
Why shouldn#39;t I use ID selectors in CSS?(為什么我不應該在 CSS 中使用 ID 選擇器?)
What does img[class*=quot;alignquot;] mean in CSS?(CSS 中的 img[class*=“align] 是什么意思?)
CSS: Last element on line(CSS:最后一個元素)
How do I select every other div class element using just CSS (no js)(如何僅使用 CSS(無 js)選擇所有其他 div 類元素)
Tool for checking unused CSS selectors?(檢查未使用的 CSS 選擇器的工具?)
主站蜘蛛池模板: 一级做a毛片 | 国产一区久久精品 | 一级片在线观看 | 色视频在线免费观看 | 久草视频在 | 中国xxxx性xxxx产国 | 91电影| 亚洲一区二区在线 | 日韩中文一区 | 凹凸日日摸日日碰夜夜 | 欧美日本韩国一区二区 | 在线不卡视频 | 久久久亚洲精品视频 | 免费人成在线观看网站 | 国产97碰免费视频 | 中文字幕一区在线观看视频 | 国产成人高清在线观看 | 国产成人精品午夜 | 中文字幕日韩欧美一区二区三区 | 九九久久这里只有精品 | 波多野结衣一区二区 | 蜜桃一区| 欧美一级免费看 | 日本一区二区三区四区 | 日韩有码一区 | 国产成人99久久亚洲综合精品 | 噜噜噜色网 | 中文字幕在线观看一区 | 精品久久99 | 国产精品美女一区二区 | 久久精品a | 9色网站 | 中文字幕日韩一区 | 国产午夜精品福利 | 精品国产一区探花在线观看 | 亚洲成人久久久 | 久久r免费视频 | 日韩精品一区二区三区在线播放 | 亚洲一区久久 | 欧美日韩在线一区二区三区 | 午夜视频在线免费观看 |