樣式具有 "readonly" 屬性的元素在 CSS 中的樣式
若要選擇只讀的元素,請使用 CSS :read-only 選擇器。
示例
你可以嘗試執行以下程式碼來實現 :read-only 選擇器
<!DOCTYPE html>
<html>
<head>
<style>
input:read-only {
background-color: blue;
color: white;
}
</style>
</head>
<body>
<form>
Subject: <input type = "text" name = "subject" value = "Maths"><br>
Student: <input type = "text" name = "student" readonly value = "Amit"><br>
</form>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP