Skip to main content
All CollectionsTechnical guides
Building custom layouts
Building custom layouts
Thomas K avatar
Written by Thomas K
Updated over 2 months ago

πŸ’‘

We do not provide support for code customizations

If you are not comfortable making code changes, we highly recommend hiring an expert developer.

Summary


πŸ’‘ Tip: Duplicate your theme before making code changes. This will ensure you have a backup to revert to if needed.

In Paper, Tailwind CSS plays a significant role in shaping the layout. Two common approaches have been predominantly employed for layout styling throughout the theme: Grid and Flexbox. By identifying and modifying the associated classes, you can easily change your layout.

Grid layouts


The grid layout in Tailwind CSS offers a powerful way to create complex, responsive designs. It's based on the CSS Grid Layout module and allows you to create two-dimensional layouts with ease. Here are some steps to edit your Paper Shopify theme using the grid approach:

  1. Identify the grid container: Look for the element with the grid class in your theme's HTML code. This will be the parent element for all grid items.

  2. Define grid columns and rows: Use the grid-cols-* and grid-rows-* classes to specify the number of columns and rows in your grid. Replace the asterisk (*) with a number to define the desired layout.

  3. Position grid items: Assign the col-start-*, col-end-*, row-start-*, and row-end-* classes to your grid items to control their position in the grid. You can also use col-span-* and row-span-* to control how many columns or rows a grid item should span.

  4. Make your grid responsive: Use Tailwind's responsive utilities like md:grid-cols-* to adapt your grid layout for different screen sizes.

Flexbox layouts


Flexbox is another powerful layout system in Tailwind CSS that makes it easy to create one-dimensional layouts. Follow these steps to edit your Paper Shopify theme using the flexbox approach:

  1. Identify the flex container: Look for the element with the flex class in your theme's HTML code. This will be the parent element for all flex items.

  2. Control the direction of flex items: Use the flex-row or flex-col class to define the direction in which your flex items should be displayed. Add reverse to reverse the order of the items.

  3. Align and justify flex items: Utilize the items-* and justify-* classes to align and justify your flex items within the container. Replace the asterisk (*) with keywords like start, center, end, stretch, or baseline for alignment, and start, center, end, between, or around for justification.

  4. Set the width of a column: To set the width of a flex item, use the w-* class and replace the asterisk (*) with a value. For example, use w-1/2 for 50% width, w-1/3 for 33.33% width, or w-full for 100% width. You can also use fixed-width classes like w-64 for a 16rem width or responsive utilities like md:w-1/2 to set the width based on screen sizes.

  5. Make your flexbox responsive: Apply Tailwind's responsive utilities like md:flex-row to adapt your flexbox layout for different screen sizes.

Did this answer your question?