From the course: CSS: Selectors
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Error checking: :valid, :invalid, :in-range, :out-of-range - CSS Tutorial
From the course: CSS: Selectors
Error checking: :valid, :invalid, :in-range, :out-of-range
- [Instructor] To wrap up our section, mostly on forms, let's look at some error checking. Now, spoiler alert. There is no true error checking with only HTML and CSS. Error checking on forms must come from JavaScript before submission, or you can check errors server side after submission with a variety of approaches. Or you can do both. We however, will do no real error checking with this form. However, just because we're not submitting data, or really checking for errors doesn't mean we can't apply styling. HTML and CSS may indeed check to see if requirements are met in a very limited way. In other words, HTML and CSS may indicate that requirements are met or not, but it will not enforce meeting those requirements, like preventing a form submission. It is enough to apply some styling, but it's not enough for true form validation. So with those caveats out of the way, let's look at valid and invalid. The easiest thing to do is to apply these styles to the page. We'll start with valid.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Form controls: :required and :optional; :enabled and :disabled5m 55s
-
(Locked)
Form controls: :read-only and :read-write5m 57s
-
(Locked)
Form control states: :indeterminate, :default, :checked6m 41s
-
(Locked)
Text fields: :autofill, :placeholder-shown7m 2s
-
(Locked)
Error checking: :valid, :invalid, :in-range, :out-of-range8m 15s
-
(Locked)
-
-
-