केवल-पढ़ने के लिए तत्वों का चयन करने के लिए CSS :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>