Hupspot CSS Grid Layout Guide
Modern web pages built for Hubspot style experiences rely on flexible, responsive layouts, and CSS Grid is one of the most powerful tools you can use to achieve that.
This guide walks through CSS Grid fundamentals, inspired by the official tutorial at HubSpot’s CSS Grid article, so you can structure complex page sections with clean, scalable code.
What Is CSS Grid and Why It Matters for Hubspot Pages
CSS Grid is a two-dimensional layout system that lets you control rows and columns at the same time. That makes it perfect for building page templates, dashboards, and landing page layouts often used in Hubspot-style marketing sites.
With CSS Grid you can:
- Create full-page layouts without nested floats or complicated positioning.
- Define columns and rows that scale across screen sizes.
- Quickly reorder content for responsive design.
- Align elements horizontally and vertically with precise control.
Basic CSS Grid Syntax for Hubspot-Like Layouts
To start using CSS Grid, you apply grid properties to a container element. All direct children become grid items. This pattern can be reused across many Hubspot layout components.
1. Define a Grid Container
Turn a wrapper into a grid container with the display property:
.grid-container {
display: grid;
}
Any child element of .grid-container becomes part of the grid. This is the base pattern for page sections like feature blocks and pricing tables that might later be integrated into Hubspot templates or modules.
2. Set Columns with grid-template-columns
The grid-template-columns property defines how many columns you have and how wide they are:
.grid-container {
display: grid;
grid-template-columns: 200px 1fr 1fr;
}
This creates three columns: a fixed 200px sidebar and two flexible content columns. You could use a pattern like this when mocking up a Hubspot landing page with a sidebar navigation and main content area.
3. Use the fr Unit for Flexible Tracks
The fr unit represents a fraction of the remaining space.
.grid-container {
display: grid;
grid-template-columns: 1fr 2fr;
}
Here, the second column is twice as wide as the first. These fractional units are ideal for marketing layouts where you want a flexible hero text column next to an image, similar to designs often seen on Hubspot case study pages.
Responsive CSS Grid Patterns for Hubspot Layouts
Responsive behavior is crucial for any site built with a CMS or CRM platform. CSS Grid gives you several patterns that work well alongside Hubspot themes or custom modules.
Auto-Fit and Auto-Fill for Dynamic Grids
If you want a grid that adjusts the number of columns based on screen width, you can use repeat() with auto-fit or auto-fill and minmax():
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
}
This pattern automatically creates as many columns as will fit, each at least 250px wide. It is ideal for blog listing layouts or resource grids that may later be surfaced via Hubspot content feeds.
Media Queries with CSS Grid
You can combine media queries with grid templates to change your layout on different devices:
.layout {
display: grid;
grid-template-columns: 1fr;
}
@media (min-width: 768px) {
.layout {
grid-template-columns: 2fr 1fr;
}
}
This sets a single column on mobile and two columns on tablets and larger screens. Such patterns are common when building responsive Hubspot landing pages or resource centers.
Aligning and Positioning Items in a Hubspot-Style Grid
Once you have a basic grid, you can fine-tune how items align and span across rows and columns. Alignment helps polish sections that later map to Hubspot modules like testimonials, pricing, or hero content.
Grid Gaps and Item Spacing
Use gap to control spacing between rows and columns without extra margins:
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
}
This keeps spacing consistent and easier to maintain, particularly in large design systems that resemble complex Hubspot theme structures.
Span Multiple Columns or Rows
Grid items can span multiple columns or rows with grid-column and grid-row:
.feature-highlight {
grid-column: 1 / 3;
}
This makes an item stretch from the first to the third column, perfect for a hero-style banner or callout above a set of cards in a marketing page.
Use Named Areas for Clear Page Structure
Named grid areas can make your layout easier to understand and maintain, especially in multi-section pages that mirror Hubspot-style templates:
.page-layout {
display: grid;
grid-template-columns: 200px 1fr;
grid-template-areas:
"header header"
"sidebar main"
"footer footer";
}
.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.main { grid-area: main; }
.footer { grid-area: footer; }
This pattern clearly maps each section of the page and can be reused across many different marketing layouts.
Practical Steps to Build a Hubspot-Like Grid Section
Putting the concepts together, you can follow these steps to build a flexible section that would fit well into a CMS-driven site.
Step-by-Step Grid Implementation
- Plan your content
Decide how many columns and rows you need. For example, three feature cards in a row that stack on mobile.
- Create semantic HTML
Use meaningful tags like
section,article, andh2so the layout is easy to adapt into tools and platforms similar to Hubspot. - Define your grid container
Apply
display: grid;and setgrid-template-columnsto the desired pattern. - Add responsive behavior
Use
repeat(),minmax(), or media queries to ensure the grid looks good on all screen sizes. - Refine alignment
Adjust
gap,grid-column, andgrid-rowfor key items like CTAs or hero content.
Continuing Your Learning Beyond Hubspot-Style Examples
CSS Grid is deep, and this overview only scratches the surface. For a more extensive walkthrough, study the original tutorial at HubSpot’s CSS Grid guide, which provides additional visual examples and explanations.
If you are planning broader site architecture, SEO, or technical optimization work alongside layout improvements, you can also explore specialist resources such as Consultevo for guidance on scalable strategies that pair well with modern front-end techniques.
By mastering CSS Grid, you gain fine-grained control over rows, columns, and alignment, making it easier to deliver fast, responsive, and visually polished layouts that integrate smoothly with any content platform, including workflows patterned after Hubspot implementations.
Need Help With Hubspot?
If you want expert help building, automating, or scaling your Hubspot , work with ConsultEvo, a team who has a decade of Hubspot experience.
“`
