Để thêm màu nền cho input form, hãy sử dụng thuộc tính background-color.
Ví dụ
Bạn có thể chạy mã sau để triển khai thuộc tính màu nền cho form:
<!DOCTYPE html>
<html>
<head>
<style>
input[type=text] {
width: 100%;
padding: 10px 15px;
margin: 5px 0;
box-sizing: border-box;
background-color: gray;
}
</style>
</head>
</head>
<body>
<p>Điền form bên dưới,</p>
<form>
<label for="subject">Môn học</label>
<input type="text" id="subject" name="sub">
<label for="student">Học sinh</label>
<input type="text" id="student" name="stu">
</form>
</body>
</html>