H5新增屬性

2021-10-07 12:34:20 字數 1932 閱讀 8510

<

!doctype html>

"en"

>

"utf-8"

>

"viewport" content=

"width=device-width, initial-scale=1.0"

>

document<

/title>

/* cursor: pointer;出現小手 */

button

/* 屬性選擇器使用方法 */

/* 相當於交集選擇器,即表示既有button屬性又有disabled屬性 */

/* 屬性選擇器的權重高於標籤選擇器(權重為1) */

/* 類選擇器,屬性選擇器,偽類選擇器,權重偽10 */

button[disabled]

/* 通過選擇屬性值的不同,選擇不同的屬性 */

input[type=

"search"

]/* */

div[

class

^="icon"

]/* */

div[

class$=

"icon"

]/* */

span[

class

*="_1"

]<

/style>

<

/head>

<

!-- disabled是禁用按鈕 --

>

按鈕<

/button>

按鈕<

/button>

"disabled"

>按鈕<

/button>

"disabled"

>按鈕<

/button>

"text" name=

"" id=

"" value=

"文字框"

>

"text" name=

"" id=

"" value=

"文字框"

>

"text" name=

"" id=

"" value=

"文字框"

>

"search" name=

"" id=

"" value=

"搜尋框"

>

"search" name=

"" id=

"" value=

"搜尋框"

>

"search" name=

"" id=

"" value=

"搜尋框"

>

<

!-- 選擇以某一型別開頭的標籤 --

>

="icon1"

>圖示1

<

/div>

="icon2"

>圖示2

<

/div>

="icon3"

>圖示3

<

/div>

<

!-- 選擇以某一型別結尾的標籤 --

>

="12icon"

>圖示1

<

/div>

="34icon"

>圖示2

<

/div>

="56icon"

>圖示3

<

/div>

="sd_1bh"

>1

<

/span>

="_1bh"

>2

<

/span>

="sd_1"

>3

<

/span>

<

/body>

<

/html>

h5 新增屬性

預設提示內容 placeholder 多輸入,多提交 multiple 支援乙個域中多輸入,逗號隔開,一般配合郵箱和url型別使用 自動獲取焦點,頁面載入,自動獲取焦點游標 autofocus 防止空提交 required 允許輸入的最小字元數和最大字元數 minlength 允許輸入的最小字元長度...

h5新增常用屬性

頭部 導航文章 側邊導航 底部 缺點 相容性比較差,ie9以上才可識別。ie8及以下如何識別?1.手動用js建立標籤 注意 一定要先建立在使用。js建立的標籤都是行內元素,要將其 轉換成塊元素,或者加浮動。2.引入庫 薪資 手機號 你最喜歡的顏色 偶像的名字 體重 h5的下拉列表 磁碟占用 框架標籤...

H5新增屬性classList

h5中新增了乙個classlist,原生js可以通過它來判斷獲取dom節點有無某個class。classlist是html元素物件的成員,它的使用非常簡單,比如 console.log document.body.classlist 目前已知classlist api有length,item,add...