Logo
ProductChangelogPricing
Try it free
Logo
Logo
DocsPrivacyTermsRSS

©Quotion 2025. All rights reserved.

Made with
  1. Post
  2. How to use breakpoints (media query) with TailwindCSS

Engineering

1 min read

How to use breakpoints (media query) with TailwindCSS

Written by

QI

Qing

Creator, Quotion

Published on

2/3/2024

Table of contents

Add a custom breakpoint to the config fileUse arbitrary breakpoints directly

The image showcases the Tailwind CSS logo with a gradient background. The logo features a stylized wave symbol and the text 'tailwindcss v3.4'. The overall mood is modern and clean, with a focus on the software's branding.

#Engineering
TailwindCSS is a popular CSS framework, sometime you may want to use an arbitrary media query to make your website responsive, here are 2 options to do that.

Add a custom breakpoint to the config file

Add your breakpoints to the tailwind.config.js:

/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {
    extend: {
      screens: {
        '3xl': '1600px',
      },
    },
  },
  plugins: [],
}
 

Then, you can use this breakpoint in the html, like this:

<div class="hidden 3xl:block"></>

Use arbitrary breakpoints directly

Sometime you may don’t want to add an official breakpoint to the tailwind.config.js, just using an arbitrary breakpoint for a specific case is more convenient. You can use an arbitrary breakpoint with [] syntax, like this:

<div class="h-64 bg-red-500 [@media(min-width:711px)]:bg-green-500"></div>

Checkout the live demo.

Actually, you can use more arbitrary controls, like CSS values, CSS properties, and TailwindCSS variants, checkout the official doc for more details.

Create your blogs directly from Apple Notes.

Say goodbye to complex CMS updates and management issues!

You focus on creating quality content while Quotion takes care of the rest.

Learn MoreTry It Free

Subscribe to Quotion

Get the latest posts delivered to your inbox. No spam, unsubscribe anytime.

We care about your data in our privacy policy.

Latest

More from the site

    Qing

    AppleNotes

    Apple Notes Updates 2024

    #AppleNotes iPad18 & iOS18 introduced many powerful new features for Apple Notes. Math Notes There is a new Math Notes folder in the Notes app, which you can type or write out mathematical expression

    Read post

    Qing

    AppleNotes

    How to Share Apple Notes and Collaborate with Others

    #AppleNotes Did you know you can share your notes with other iCloud users in Apple Notes? Besides, you can also collaborate with others to work on the same notes, everyone can see each other's changes

    Read post

    Qing

    AppleNotes

    Use Templates in Apple Notes

    #AppleNotes If you use Apple Notes daily like me, you may want to use templates to setup your daily notes quickly. Since Apple Notes doesn't have a built-in template feature. Here are some apps I foun

    Read post

View all posts