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

จัดสไตล์อินพุตที่เปิดใช้งานด้วย CSS


Pseudo-class :enabled

ใช้ :enabled เลือก <input> ที่ไม่มีแอตทริบิวต์ disabled (คือพร้อมใช้งาน)

ตัวอย่าง

<!DOCTYPE html>
<html>
<head>
  <style>
    input:enabled {
      background: blue;
    }
  </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" disabled><br>
  </form>
</body>
</html>