Pseudo-class :optional
ใช้ :optional เลือก <input> ที่ ไม่มี แอตทริบิวต์ required
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
input:optional {
background-color: blue;
}
</style>
</head>
<body>
<form>
Subject: <input type="text" name="subject"><br>
Student: <input type="text" name="student" required><br>
</form>
</body>
</html>