Hướng Dẫn Tạo Placeholder Cho select box Trong HTML/CSS SinhVienCNTT.Net

Hướng Dẫn Tạo Placeholder Cho select box Trong HTML/CSS SinhVienCNTT.Net

by sinhviencntt

HTML

<!DOCTYPE html>
<html>
<style>
/*select có value="" nghĩa là nó có giá trị không hợp lệ thì màu nâu được hiển thị*/
select:required:invalid {
  color: gray;
}
/*option có value="" và trạng thái disabled không được hiển thị khi nhấn vào mũi tên tam giác. Bình thường thì nó vẫn được hiển thị*/
option[value=""][disabled] {
  display: none;
}
/*option có màu đen */
option {
  color: black;
}
</style>
<body>
<h1>Hướng Dẫn Tạo Placeholder Cho select box Trong HTML/CSS SinhVienCNTT.Net</h1>
<form action="">
  <input type="text" name="hoTen" placeholder="Hãy Nhập Vào Họ Và Tên"><br><br>
  <input type="text" name="queQuan" placeholder="Hãy Nhập Vào Quê Quán"><br><br>
  <select required>
    <option value="" disabled selected>Hãy Chọn Giới Tính</option>
    <option value="nam">Nam</option>
    <option value="nu">Nữ</option>
</select><br><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>