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

文本輸入字段的 CSS 選擇器?

CSS selector for text input fields?(文本輸入字段的 CSS 選擇器?)
本文介紹了文本輸入字段的 CSS 選擇器?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何使用 CSS 選擇器定位文本"類型的輸入字段?

解決方案

input[type=text]

或者,限制表單內的文本輸入

表單輸入[type=text]

或者,進一步限制為某種形式,假設它具有 id myForm

#myForm input[type=text]

注意:IE6 不支持此功能,因此如果您想為 IE6 開發,請使用 IE7.js(如 Yijiang 建議的那樣)或開始為所有文本輸入添加類.p>

參考:http://www.w3.org/TR/CSS2/selector.html#attribute-selectors


因為規定默認屬性值不能始終可以使用屬性選擇器進行選擇,可以嘗試覆蓋其他文本輸入的標記情況:

input:not([type]),/* 標記中不存在類型屬性 */input[type=""],/* 類型屬性存在,但為空 */input[type=text]/* 類型被明確定義為'text' */

這仍然會在定義類型但具有無效值并且仍回退到 type=text"時的情況.為了涵蓋這一點,我們可以使用選擇不是其他已知類型之一的所有輸入

input:not([type=button]):not([type=password]):not([type=submit])...

但是這個選擇器會很荒謬,而且 列表可能的類型隨著向 HTML 添加新功能而不斷增長.

注意::not 偽類 只支持從 IE9 開始.

How can I target input fields of type 'text' using CSS selectors?

解決方案

input[type=text]

or, to restrict to text inputs inside forms

form input[type=text]

or, to restrict further to a certain form, assuming it has id myForm

#myForm input[type=text]

Notice: This is not supported by IE6, so if you want to develop for IE6 either use IE7.js (as Yi Jiang suggested) or start adding classes to all your text inputs.

Reference: http://www.w3.org/TR/CSS2/selector.html#attribute-selectors


Because it is specified that default attribute values may not always be selectable with attribute selectors, one could try to cover other cases of markup for which text inputs are rendered:

input:not([type]), /* type attribute not present in markup */
input[type=""],    /* type attribute present, but empty    */
input[type=text]   /* type is explicitly defined as 'text' */

Still this leaves the case when the type is defined, but has an invalid value and that still falls back to type="text". To cover that we could use select all inputs that are not one of the other known types

input:not([type=button]):not([type=password]):not([type=submit])...

But this selector would be quite ridiculous and also the list of possible types is growing with new features being added to HTML.

Notice: the :not pseudo-class is only supported starting with IE9.

這篇關于文本輸入字段的 CSS 選擇器?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
主站蜘蛛池模板: 精品国产色 | 91久久国产综合久久91精品网站 | 一级视频黄色 | 精品国产乱码久久久久久老虎 | 欧洲一级黄 | 成人h动漫亚洲一区二区 | 国产精品久久久av | 日韩视频在线免费观看 | 欧美a区 | 成人在线观看免费视频 | 国产精品国产精品国产专区不蜜 | 看a级黄色毛片 | 蜜桃av一区二区三区 | 亚洲专区在线 | 91麻豆精品国产91久久久更新资源速度超快 | 天天视频一区二区三区 | 色伊人久久 | 精品欧美一区免费观看α√ | 国产精品自产av一区二区三区 | 超碰伊人| 色综合av | 亚洲视频在线一区 | 日韩欧美二区 | 黄视频网站免费观看 | 影音先锋中文字幕在线观看 | 久久岛国| 中文字幕日韩欧美 | 久久午夜影院 | 久久精品国内 | 久久综合影院 | 国产美女精品 | 中文字幕视频在线观看 | 国产露脸对白88av | 国产一区二区欧美 | 天天综合干 | 蜜月va乱码一区二区三区 | 91成人在线 | 国产精品亚洲第一区在线暖暖韩国 | 欧美日韩在线精品 | 国产精品成人av | 久久欧美高清二区三区 |