Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Role of CSS :optional Selector
Use the CSS :optional selector to style <input> elements with no "required" attribute
Example
You can try to run the following code to implement the :optional selector:
<!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>Advertisements