為帶有 CSS 焦點的元素設定樣式
要選擇具有焦點的元素,請使用:focus 選擇器。您可以嘗試執行以下程式碼來實現:focus 選擇器 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
input:focus {
background-color: green;
}
</style>
</head>
<body>
<form action = "">
Subject <input type = "text" name = "subject"><br>
Student: <input type = "text" name = "student"><br>
Age: <input type = "number" name" = age><br>
<input type = "submit" value="Submit">
</form>
</body>
</html>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP