跳过导航
Tailwind Tip #5 ✨ You can use ":invalid" pseudo class to create a pure css Tailwind CSS form…
0:00 / 0:24

Tailwind Tip #5 ✨ You can use ":invalid" pseudo class to create a pure css Tailwind CSS form…

Surjith S M ✪

@surjithctly1万 位关注者

在 X 上查看
1,001 个赞下载原帖

169,318 次观看

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 😊

10 条评论

评论来自 X (Twitter) 上的原帖

  • Surjith S M ✪ 的头像

    @surjithctly

    Join my personal newsletter ↓

    2 个赞

  • Surjith S M ✪ 的头像

    @surjithctly

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

    4 个赞

  • Surjith S M ✪ 的头像

    @surjithctly

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

    25 个赞

  • Dominik Geimer 的头像

    @dominikgeimer

    @tailwindcss Really like your tips! Keep going!

    2 个赞

  • Surjith S M ✪ 的头像

    @surjithctly

    @tailwindcss Thanks Dominik!

  • jeff pohlmeyer 的头像

    @jvpdesignllc

    @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`

    2 个赞

  • Surjith S M ✪ 的头像

    @surjithctly

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

    4 个赞

  • Khanif Ikhsanudin 的头像

    @KhanifDev

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

    2 个赞

  • Surjith S M ✪ 的头像

    @surjithctly

    @tailwindcss Yes + server side validation is a must.

    2 个赞

  • #RelaxedGuy🇺🇬 的头像

    @Segayi_Andrew

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

    1 个赞