
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
Style Input Elements with a Valid Value using CSS
Use the CSS : valid selector to style all <input> elements with a valid value .
Example
You can try to run the following code to implement the :valid Selector:
<!DOCTYPE html> <html> <head> <style> input:valid { background: red; color: white; } </style> </head> <body> <h2>Heading</h2> <input type = "email" value = "[email protected]"> <p>The style (red color background) appears if you type a relevant/ valid email address.</p> </body> </html>
Output
Advertisements