html5 - how do I use the :valid and :invalid selectors for css? -


i’m new coding , heard friend it’s possible use :valid , :invalid selectors inside css form. how do this?

actually interesting question. believe it's 1 of things that's brand new css3. not sure whether can apply it. don't think can @ moment, because tried on fiddle , wasn't working me. it's going introduced update of css selectors.

the way use this:

html:

email: <input type="email" required> 

css:

input[type=email]:invalid {   outline: red solid 3px; }   input[type=email]:valid {   outline: lightgreen solid 3px; } 

with above css, email field styled red outline before user enters anything. once user types in valid email address, outline turn green.

hopes helps!


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -