Visualize responsive breakpoint with TailwindCSS

suin - Jun 26 '19 - - Dev Community

When I was writing a responsive template using TailwindCSS, I felt that it is not easy to know which breakpoint is active.

So I made a simple component that visualizes which breakpoint is active. The following snippet is the implementation of the component:



<div class="fixed top-0 right-0 m-8 p-3 text-xs font-mono text-white h-6 w-6 rounded-full flex items-center justify-center bg-gray-700 sm:bg-pink-500 md:bg-orange-500 lg:bg-green-500 xl:bg-blue-500">
  <div class="block  sm:hidden md:hidden lg:hidden xl:hidden">al</div>
  <div class="hidden sm:block  md:hidden lg:hidden xl:hidden">sm</div>
  <div class="hidden sm:hidden md:block  lg:hidden xl:hidden">md</div>
  <div class="hidden sm:hidden md:hidden lg:block  xl:hidden">lg</div>
  <div class="hidden sm:hidden md:hidden lg:hidden xl:block">xl</div>
</div>


Enter fullscreen mode Exit fullscreen mode

Copying this and pasting to your TailwindCSS template, you will see the indicator of the breakpoint on top right in your browser.

Also, you can check the live demo at CodePen.

See the Pen Tailwind CSS Responsive Active Breakpoint Indicator by suin (@suin) on CodePen.

. . . . . . . . . . . . . . .
Terabox Video Player