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

被 CSS 偽類 :active 搞糊涂了

Confused by CSS pseudo-class :active(被 CSS 偽類 :active 搞糊涂了)
本文介紹了被 CSS 偽類 :active 搞糊涂了的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在 這里查看 CSS :active Selector.

I was looking here at CSS :active Selector.

:active 選擇器樣式鏈接到活躍頁面

The :active selector styles links to active pages

這讓我想到,HTML/CSS 術(shù)語中的活動頁面"到底是什么...

That got me thinking, what the heck is an 'active page' in HTML/CSS terminology...

此時我去了 w3docs 第 5.11.3 節(jié)動態(tài)偽類::hover、:active 和 :focus.

At this point I went to the w3docs Section : 5.11.3 The dynamic pseudo-classes: :hover, :active, and :focus.

:active 偽類適用于一個元素被激活用戶.例如,在時間之間用戶按下鼠標(biāo)按鈕并釋放它.

The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it.

所以我使用了 w3shools try it pages 之一,并且編寫一個示例,替換以下代碼,您可以將其剪切 &粘貼并嘗試.

So I used one of the w3shools try it pages and hack together an example, substituting the following code, which you can just cut & paste and try.

<html>
<head>
<style type="text/css">
:focus,:active
{
outline-offset: 10px;
outline: solid;
}
</style>
</head>

<body>
<p>Click the links to see the background color become yellow:</p>
<a href="http://www.w3schools.com">w3schools.com</a>
<a href="http://www.wikipedia.org">wikipedia.org</a>
<button type="button">Click Me!</button>
<form>
<input type="text"/>
</form>
</body>
</html>

表單域適用于:focus.但按鈕或鏈接不適用于 :active.

The form field works for :focus. But the button or links don't work for :active.

這是為什么呢?w3schools 談到的活動頁面"有什么我不明白的地方嗎?

Why is that? Is there something about 'active page' I'm not understanding that w3schools talked about.

我看到了這個 不錯的提示,但我不認(rèn)為它是相關(guān)的.

I saw this nice tip when Googling for it, but I don't think it's related.

推薦答案

CSS中沒有活動頁面"的概念.事實上,SitePoint Reference 揭穿了這一點:

There is no concept of "active page" in CSS. In fact, the SitePoint Reference debunks this by saying:

偽類表示指向活動或當(dāng)前頁面的鏈接——這是 CSS 初學(xué)者常見的誤解.

The pseudo-class does not signify a link to the active, or current, page—that’s a common misconception among CSS beginners.

規(guī)范說的是對的::active 只是設(shè)置激活元素的樣式,例如單擊(如給出的示例中)或以其他方式觸發(fā),以便瀏覽器開始導(dǎo)航到鏈接的目標(biāo).

What the spec says is right: :active simply styles elements that are activated, e.g. clicked (as in the example given) or in some other way triggered such that the browser starts navigating to the link's target.

請注意,它不僅僅適用于 <a> 元素;它可能適用于任何被點擊的非表單輸入元素.例如,您可以這樣做:

Note that it doesn't just apply to <a> elements; it may apply to any non-form-input element that's clicked. For instance, you can do this:

p:active {
    color: red;
}

并且您點擊的任何段落都會將其文本閃爍紅色.

And any paragraph you click will flash its text red.

但是請注意,確切的定義和實現(xiàn)由瀏覽器決定,但一般,您可以依賴具有激活狀態(tài)的 <a> 元素.

Note however that the exact definition and implementation is left up to the browser, but in general, you can rely on <a> elements having an activated state.

這篇關(guān)于被 CSS 偽類 :active 搞糊涂了的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

:hover:before text-decoration none has no effects?(:hover:before text-decoration none 沒有效果?)
Is CSS faster when you are specific?(當(dāng)您特定時,CSS 會更快嗎?)
CSS sibling selectors (select all siblings)(CSS 兄弟選擇器(選擇所有兄弟))
IE: nth-child() using odd/even isn#39;t working(IE:使用奇數(shù)/偶數(shù)的 nth-child() 不起作用)
How can I tell if an element is in a shadow DOM?(如何判斷一個元素是否在影子 DOM 中?)
Can I use CSS to add a bullet point to any element?(我可以使用 CSS 為任何元素添加項目符號嗎?)
主站蜘蛛池模板: 91精品国产91久久久久久最新 | 日韩久久久久久 | 国产一区亚洲 | 91在线观看 | 久久久久久久久久久久一区二区 | 国产欧美久久精品 | 国产精品久久久久久久久久三级 | 日韩精品免费播放 | 韩国精品一区 | 欧美一级大片 | 欧美日韩国产高清 | 国产精品久久视频 | 日本久草 | www网站在线观看 | 国产亚洲欧美日韩精品一区二区三区 | 亚洲成人免费在线观看 | 精品国产一区二区国模嫣然 | 黄色网页在线观看 | 日韩毛片在线免费观看 | 国产成人精品一区二区三区在线 | 麻豆91av| 亚洲一区二区成人 | 亚州精品天堂中文字幕 | 日批免费观看 | 91久久久www播放日本观看 | 日韩精品视频在线播放 | 国产精品久久久久久久久久了 | 日韩欧美精品一区 | 在线免费观看a级片 | 男女网站免费观看 | 一区二区三区免费 | 国产精品久久九九 | 99综合| 国产一区二区欧美 | 国产国拍亚洲精品av | 国产一区二区三区日韩 | 欧州一区 | 久久av网站| 欧美精品一区三区 | 日韩欧美精品一区 | 成人三级视频 |