Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Tạo kiểu cho input không có readonly với CSS

Bộ chọn :read-write - Lặp lại

Nội dung trùng lặp với bài 1003062663. :read-write chọn phần tử có thể nhập (không readonly, không disabled).

Ví dụ (giống hệt bài 1003062663)

<!DOCTYPE html>
<html>
<head>
  <style>
    input:read-write {
      background-color: blue;
      color: white;
    }
  </style>
</head>
<body>
  <form>
    Môn học: <input type="text" name="subject" value="Java"><br> <!-- read-write -->
    Sinh viên: <input type="text" name="student" readonly value="Amit"><br> <!-- read-only -->
  </form>
</body>
</html>

Ô "Môn học" (read-write) → nền xanh, chữ trắng.