首頁  >  文章  >  web前端  >  html5中焦點是啥屬性

html5中焦點是啥屬性

青灯夜游
青灯夜游原創
2022-01-23 13:49:212609瀏覽

在html5中,焦點是「autofocus」屬性,該屬性是布林屬性,規定當頁面載入時input元素應該會自動獲得焦點;如果使用autofocus屬性,則input元素會獲得焦點。

html5中焦點是啥屬性

本教學操作環境:windows7系統、HTML5版、Dell G3電腦。

在html5中,焦點是「autofocus」屬性。 該屬性是 HTML5 中的新屬性。

autofocus 屬性是一個布林屬性。

autofocus 屬性規定當頁面載入時 input 元素應該會自動獲得焦點。

如果使用該屬性,則 input 元素會獲得焦點。

語法:

<input autofocus="autofocus">

註:在 XHTML 中,禁止屬性最小化,autofocus 屬性必須定義為 <input autofocus="autofocus">。

範例:

<form action="#">
  用户名: <input type="text" name="name"><br>
  密 码: <input type="password" name="password" autofocus="autofocus"><br><br>
  <input type="submit">
</form>

html5中焦點是啥屬性

#相關推薦:《html影片教學

以上是html5中焦點是啥屬性的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn