DEV Community

Cover image for New CSS media queries syntax šŸ’„
Nikola PeriÅ”ić
Nikola PeriÅ”ić

Posted on • Edited on

New CSS media queries syntax šŸ’„

Say goodbye to Min-Width & Max-WidthšŸ‘‹šŸ»

The new CSS media query syntax changes how we define responsive breakpoints.

It makes our code cleaner and easier to understand. šŸš€

The benefits of the new syntax:

  • Clarity: The new syntax is simple and intuitive ✨

  • Efficiency: Reduced complexity leads to faster development šŸŽļø

  • Compatibility: High support across modern browsers. You can check it out here 🌐


Code Examples šŸ–„ļø

Traditionally, you might write:

CSS media query

With the new, simpler syntax, it becomes:

CSS media query

Old way:

CSS media query

New way:

CSS media query

You can also test between two widths...

CSS Media query


Conclusion 🌟

Adopting the new CSS media query syntax will simplify your code.

Please, comment on your thoughts. Your thoughts are valuable for contributing to the front-end development field. All are welcome! I want to hear them šŸ’¬

Keep up the good work! šŸ‘

Top comments (168)

Collapse
Ā 
kooiinc profile image
KooiInc •

Thanks, good to know.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

I'm glad you like it. Make sure to follow me to keep up with more content like this šŸ˜€

Collapse
Ā 
deejuh719 profile image
K Surratt •

This makes it so much easier to remember than going "wait... does max mean up to or....?" Thank you!

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Yeah, absolutely. Thank you for your support!

Collapse
Ā 
stkarlkode profile image
StKarl-kode •

Interesting. Thanks mate

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

You're welcome :)

Collapse
Ā 
darshanagravat profile image
Darshan Agravat •

🄹🄹🄹
I am so happy.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

dattebayo

Collapse
Ā 
randy918 profile image
randy918 •

My brain doesn't think straight regarding min-width, etc. It always stops me to think it out. This new way is beautiful and instant to read.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Agree

Collapse
Ā 
fadekocodeit profile image
Oluwagbenga Fadeko James •

Thanks for sharing šŸ‘

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

You're welcome :)

Collapse
Ā 
syedmuhammadaliraza profile image
Syed Muhammad Ali Raza •

nice

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Thank you :)

Collapse
Ā 
machineno15 profile image
Tanvir Shaikh •

finally they are here.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Yeah! :)

Collapse
Ā 
damienschneider profile image
Damien Schneider •

So much clearer, no one can be against this change. Love this.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Totaly agree :)

Collapse
Ā 
temaroon profile image
Aditya •

This made it much clear for beginners.

Collapse
Ā 
perisicnikola37 profile image
Nikola PeriŔi㠕

Yeah. It is much more clean now