久久久久久久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 選擇器的工具?)
主站蜘蛛池模板: 国产精品久久久久久久岛一牛影视 | 日本精品一区二区三区在线观看视频 | 999久久久国产精品 欧美成人h版在线观看 | 全免费a级毛片免费看视频免 | 国产精品亚洲欧美日韩一区在线 | 久久久久久精 | 国产av毛片 | 永久免费视频 | 巨大荫蒂视频欧美另类大 | 玖玖国产| 日本a级大片 | 国产精品国产成人国产三级 | 国产一区二区三区四区在线观看 | 欧美天天视频 | 亚洲免费人成在线视频观看 | 亚洲 欧美 综合 | 色小姐综合网 | 欧美色专区 | 99这里只有精品 | 成人毛片在线视频 | 国产成人免费视频网站视频社区 | 男女啪啪高潮无遮挡免费动态 | 免费中文字幕 | 一本在线 | 国产精品国产成人国产三级 | 手机av在线| 国产一区二区三区色淫影院 | 久久精品视频在线观看 | 羞羞视频一区二区 | ririsao久久精品一区 | 91精品久久| 亚洲成人一区 | 天堂av中文在线 | 伊人啪啪网 | 狠狠草视频| 久草在线在线精品观看 | 一区在线免费视频 | 韩日免费视频 | 91xx在线观看 | 国产成人精品一区二区三区在线 | 日韩成人av在线 |