Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | :invalid Selector

Improve Article
Save Article
Like Article
  • Last Updated : 23 Aug, 2022
Improve Article
Save Article
Like Article

This :invalid selector is used to select every form elements which does not validate according to the elements. This selector works only for some form elements with limitations such as input elements with min and max attributes, email fields with a legal email, or number fields with a numeric value, etc. Instead of using the :invalid selector, the :valid selector is used to selects the form elements which validate according to the element. 


:invalid {
    // CSS property



<!DOCTYPE html>
        <title>invalid selector</title>
            h1 {
            input:invalid {
                border: 1px solid black;
            body {
        <h2>:invalid Selector</h2>
        Email Address: <input type="email" placeholder="">



Supported Browsers: The browser supported by :invalid selector are listed below:

  • Apple Safari 5.0
  • Google Chrome 10.0
  • Edge 12.0
  • Firefox 4.0
  • Opera 10.0
My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!