Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Tailwind Tip #5 ✨ You can use ":invalid" pseudo class to create a pure css Tailwind CSS form validation without javascript. View code 👇 (5/30) follow for 25 more tips 😊

169,272 Aufrufe • vor 3 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

Join my personal newsletter ↓

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

💡You might want to remove "novalidate" from the <form> so that users cannot submit using keyboard "tab"

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

💡 You can also add the invalid class as a custom variant to declutter your html. Here's the updated version:

Profilbild von Dominik Geimer
Dominik Geimervor 3 Jahren

@tailwindcss Really like your tips! Keep going!

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

@tailwindcss Thanks Dominik!

Profilbild von jeff pohlmeyer
jeff pohlmeyervor 3 Jahren

@tailwindcss Holy hell, that's a lot of modifiers. There's got to be a better way than something like `[&:not(:placeholder-shown):not(:focus):invalid~span]:block`

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

@tailwindcss you can simplify it using tailwind-config by creating custom variants. See ↓

Profilbild von Khanif Ikhsanudin
Khanif Ikhsanudinvor 3 Jahren

@tailwindcss for simple validation its ok, but for complex validation you have to use javascript

Profilbild von Surjith S M ✪
Surjith S M ✪vor 3 Jahren

@tailwindcss Yes + server side validation is a must.

Profilbild von #RelaxedGuy🇺🇬
#RelaxedGuy🇺🇬vor 3 Jahren

@tailwindcss Hey man really waited for the dribble page I shared to be put to life

Ähnliche Videos