html5中焦點是啥屬性

青灯夜游
發布: 2022-01-23 13:49:21
原創
2586 人瀏覽過

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

html5中焦點是啥屬性

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

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

autofocus 屬性是一個布林屬性。

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

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

語法:

<input autofocus="autofocus">
登入後複製

註:在 XHTML 中,禁止屬性最小化,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中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!