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

    ProductUpdate

    Post visibility and search engine indexing controls

    #ProductUpdate We're excited to introduce new features that give you more control over your posts! Post visibility Control whether posts appear in your site's content listing while remaining accessibl

    Read post

    Qing

    ProductUpdate

    Post scheduling and published date editing

    #ProductUpdate We’re excited to announce 2 new features: you can now schedule posts to go live at a specific time and edit the published date of your posts! How to schedule a Post Need to announce som

    Read post

    Qing

    ProductUpdate

    Layout editor

    #ProductUpdate 🔥 I'm so excited to announce that the layout editor is live now. You can easily edit your site layout inside the design page, home note is no longer needed! All home note functionalit

    Read post

View all posts