When it comes to tailwind layouts we have basically two main options.
If you know me, I use Flex for a lot of things. It's one of these things you start with and end up using for a lot of elements.
Lean how to create a responsive image grid in Tailwind in this short episode of CodeTime.io. Easily generate responsive grids for Tailwind CSS projects. All of the generated classes are based on the Tailwind defaults, just choose your settings to get started. 30 templates, 600+ beautifully crafted drop-in ready UI components for creating user-centric applications using Tailwind CSS in RECORD TIME!
Today however I want to explore some grid action in Tailwind and see just how easy it can be.
We'll be creating a 4 column block layout for large devices, on tablet size they should stack 2-2 and on mobile, it should be 1 column.
The end result is as the following:
4 Column grid blocks in Tailwind permalink
Let's start with our basic structure and style from there.
Grid Tailwind For Sale
As you can see, I choose a double wrapper, the top div will be our container and the inner one will be the actual grid.
Let's add some basic styles for the containers first.
This will already give us quite a good column space.
Let's quickly add some styling for our blocks.
Pretty solid right?
However, this is not yet responsive, luckily for us, the Tailwind grid is super easy to make responsive.
All we have to do is add the breakpoints on our grid element.
Remember: Tailwind is mobile-first so that will be the mobile view.
You can find the full demo on this Codepen.
Tailwind Css Layout
See the Pen Tailwind grid responsive 4 column blocks by Chris Bongers (@rebelchris) on CodePen.
Thank you for reading, and let's connect! permalink
Css Grid Column Span
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter