Skip to content

Instantly share code, notes, and snippets.

@sitefinitysteve
Last active September 13, 2024 06:21
Show Gist options
  • Save sitefinitysteve/b4d437518cd795849d99577dc3e618d4 to your computer and use it in GitHub Desktop.
Save sitefinitysteve/b4d437518cd795849d99577dc3e618d4 to your computer and use it in GitHub Desktop.
Tailwind responsive breakpoint viewer
<!-- TAILWIND CSS RESPONSIVE SIZE -->
<span class="text-xs text-gray-200 tailwind-breaks">
<span class="inline-block sm:hidden">XS</span>
<span class="hidden sm:inline-block md:hidden">SM</span>
<span class="hidden md:inline-block lg:hidden">MD</span>
<span class="hidden lg:inline-block xl:hidden">LG</span>
<span class="hidden xl:inline-block">XL</span>
</span>
<!-- BOOTSTRAP 4.6 VERSION -->
<li class="bootstrapsize">
<span class="d-xs-block d-sm-none d-md-none d-lg-none d-xl-none">XS</span>
<span class="d-none d-sm-block d-md-none d-lg-none d-xl-none">SM</span>
<span class="d-none d-sm-none d-md-block d-lg-none d-xl-none">MD</span>
<span class="d-none d-sm-none d-md-none d-lg-block d-xl-none">LG</span>
<span class="d-none d-sm-none d-md-none d-lg-none d-xl-block">XL</span>
</li>
@semoal
Copy link

semoal commented May 15, 2023

Version that it's shown floating and you can scroll and see the responsive size, also added 2XL breakpoint.

React version

<div className="sticky z-50 top-0 text-2xl text-white flex items-center justify-center rounded-full bg-yellow-400 font-semibold w-32 h-32">
        <span className="inline-block sm:hidden">XS</span>
        <span className="hidden sm:inline-block md:hidden">SM</span>
        <span className="hidden md:inline-block lg:hidden">MD</span>
        <span className="hidden lg:inline-block xl:hidden">LG</span>
        <span className="hidden xl:inline-block">XL</span>
        <span className="hidden 2xl:inline-block">2XL</span>
      </div>

If you're using html, just replace className by class

@Dineshs91
Copy link

I've built a free chrome extension Tailwind responsive breakpoint display if anyone is looking to not adding their own code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment