Andrew G Bliss

Tailwind CSS Responsive Debugging

2021-04-27
Tailwind CSS Responsive Debugging

Creating responsive websites in Tailwind CSS is a breeze, hence the logo. Responsive websites allow you to create one website that fits perfectly on all device resolutions, however figuring out what screen size you are on is sometimes a challenge.

Your best bet is to use developer tools to grow and shrink the screen according to the target device, however it can sometimes leave you to wonder what breakpoints you are hitting?

Here is a little HTML snippet you can use to show you what breakpoints you are hitting. Once you are done you can comment it out of your webpage.

<div
  className="fixed bottom-0 right-0 p-6 w-8 h-8 bg-white border flex justify-center items-center opacity-75"
>
  <div className="block sm:hidden md:hidden lg:hidden xl:hidden 2xl:hidden">
    XS
  </div>
  <div className="hidden sm:block md:hidden lg:hidden xl:hidden 2xl:hidden">
    SM
  </div>
  <div className="hidden sm:hidden md:block lg:hidden xl:hidden 2xl:hidden">
    MD
  </div>
  <div className="hidden sm:hidden md:hidden lg:block xl:hidden 2xl:hidden">
    LG
  </div>
  <div className="hidden sm:hidden md:hidden lg:hidden xl:block 2xl:hidden">
    XL
  </div>
  <div className="hidden sm:hidden md:hidden lg:hidden xl:hidden 2xl:block">
    2XL
  </div>
</div>

This will show a little box in the bottom right of the screen that shows what breakpoint you are on, and of course you can modify this if you have custom breakpoints.

Happy responsive coding!


More Articles

Being a Developer and Dealing with Imposter Syndrome

Being a Developer and Dealing with Imposter Syndrome

The training you receive at your company wont prepare you for all that is necessary in completing certain tasks. However the greatest difficulty is the way we think about ourselves.

How to Create an Auto Coder Pad with React and Tailwind CSS

How to Create an Auto Coder Pad with React and Tailwind CSS

In this article we will go over how to create an auto coder pad with React and Tailwind CSS.

Composition over inheritance

Composition over inheritance

Building flexible systems by favoring object composition over class inheritance