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

CSS 直接后代 (>) 在選擇性方面沒有任何價值

Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價值嗎?)
本文介紹了CSS 直接后代 (>) 在選擇性方面沒有任何價值嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

鑒于以下類聲明和代碼...

Given the following class declarations and code...

.foo > a { color:green; }
.bar a { color:red; }

<div class="bar">
    <div class="foo">
        <a href="#">SOME LINK</a>
    </div>
</div>

... 我認為鏈接會是綠色的,因為雖然兩個聲明都有一個類 (010) 和一個元素 (001),但 .foo 有直接后代選擇器.但是,唉,鏈接是紅色的.為什么?

... I thought that the link would be green because, while both declarations have a class (010) and an element (001), .foo has the direct descendant selector. But alas, the link is red. Why?

推薦答案

> 對于 css 特異性沒有任何價值.

There's no value for > for css specificity.

這兩種情況都有 11 個特異性值:

Both case have 11 value for specificity:

.foo > a { color:green; }/*specificity value is 11*/
.bar a { color:red; }/*specificity value is 11*/

<小時>

在您的情況下,您可以像這樣使用以獲得更大的特異性:


In your case you may use like this to have greater specificty:

.bar .foo > a { color:green; }/*greater specificity value is 21*/
.foo a { color:red; }/*specificity value is 11*/

<小時>

好的,我將在這里添加特異性的工作原理:


Ok, I'm going add here how specificity works:

Selector                          Specificity         Specificity in large base
inline-style                      1 0 0 0             1000
id selector                       0 1 0 0              100
class,pseudo,attribute selector   0 0 1 0               10
type selector and pseudo elements 0 0 0 1                1                     

這篇關于CSS 直接后代 (&gt;) 在選擇性方面沒有任何價值嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

CSS selector when :target empty(:target 為空時的 CSS 選擇器)
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?)
CSS: Select element only if a later sibling exists(CSS:僅當存在較晚的兄弟時才選擇元素)
主站蜘蛛池模板: av网站在线免费观看 | 国产一级成人 | 91精品国产麻豆 | 亚洲www啪成人一区二区 | 成人精品一区二区三区中文字幕 | 天天夜干 | 99这里只有精品视频 | 国产欧美精品在线 | 毛片a级 | 99精品视频一区二区三区 | 国产日日操| 欧美乱大交xxxxx另类电影 | 午夜一区二区三区视频 | 欧美一区视频 | 北条麻妃一区二区三区在线观看 | 一区二区在线看 | 国产一区二区在线免费观看 | 99re在线 | 国产精品99久久久久久大便 | 国产高清精品一区二区三区 | 一本久久a久久精品亚洲 | 男女羞羞视频在线看 | 中文字幕第一页在线 | 九九伊人sl水蜜桃色推荐 | 精品欧美一区二区精品久久久 | 成人依人 | 国产亚洲成av人在线观看导航 | 亚洲国产精品成人久久久 | 91视频播放| 国产免费一区二区 | 成人精品鲁一区一区二区 | 亚洲啊v在线 | 午夜手机在线 | 国产欧美日韩综合精品一区二区 | 欧美精品一区二区蜜桃 | 久久久av中文字幕 | 91视频麻豆| 97av在线| 久久国产精品亚洲 | 亚洲人成一区二区三区性色 | 久久噜噜噜精品国产亚洲综合 |