Validating emails using CSS

Validating emails using CSS
0

#1

Hi All,
I’m working on the Build a Survey Form project and want to know if there is a way to validate an email using CSS.
The directions state, “You can use HTML, JavaScript, and CSS to complete this project. Plain CSS is recommended because that is what the lessons have covered so far and you should get some practice with plain CSS,” which make it seem like I should be able to use plain CSS to do this, but I haven’t found anyway to do it without using some type of script?

Can it be done with CSS? Same question for the validation of numbers.
Any input would be very helpful.
Thanks!
Keenan


#2

You can’t validate emails with css but you can with html.

Give your input box type of email then it will automatically validate for you.


#3

You can write own rules to validate the field with patern=""

https://www.html5-tutorial.net/form-validation/validating-email/#aelm4759 An example.


#4

you can use html5 to validate some inputs, for exmple if you want to make an input required you can use the required attribute

<input type="text" required>

you can find more information and examples in this article

https://www.the-art-of-web.com/html/html5-form-validation/


#5

Thanks! I had my input box type set to “text” not “email”. It’s those little nuances that can drive you crazy. lol
Now I’ve only got one more error to try and fix before this project passes all the tests.