Skip to content
Web Dev Simplified
×0.8YouTube long-form

CSS Finally Has if() Statements (but I don’t think I will use them)

WDWeb Dev Simplified@WebDevSimplified · 1.8M subscribers
Views
38.8K
38,773
Outlier
×0.8
Median 47.5K
Length
10:57
Published
Jun 24, 2025
Tuesday
Comments
143
1.7K likes

Script

No transcript

Scout reads the transcripts of each creator's 12 latest long-form videos. This one isn't among them yet.

Description

Having the ability to do if statements in CSS would have been a dream of mine years ago, and it is finally a reality. Surprisingly, though, I don’t think I will end up using them much (if at all). In this video I will show you how these if statements work as well as talk about why I don’t see much use for them.

📚 Materials/References:

CSS attr() Video:    • This CSS Update Revolutionizes CSS For Me ...

🌎 Find Me Here:

My Blog: https://blog.webdevsimplified.com

My Courses: https://courses.webdevsimplified.com

Patreon:   / webdevsimplified

Twitter:   / devsimplified

Discord:   / discord

GitHub: https://github.com/WebDevSimplified

CodePen: https://codepen.io/WebDevSimplified

⏱️ Timestamps:

00:00 - Introduction

00:24 - The problem

01:32 - if CSS function

05:02 - if style checks

07:00 - Example use case for if function

09:13 - if attr checks

#CSS #WDS #CSSIf

More from Web Dev Simplified

Search Scout

Search creators, videos and pages, then press Enter to open one.