Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

บทบาทของ CSS :Selector แบบอ่านอย่างเดียว


ใช้ CSS :read-only selector เพื่อเลือกองค์ประกอบที่เป็นแบบอ่านอย่างเดียว

ตัวอย่าง

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้ตัวเลือก :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>