While Flexbox provides powerful layout capabilities, CSS Grid offers an even more sophisticated approach to web design. Think of Grid as a two-dimensional layout system that creates precise column-and-row structures, giving you unprecedented control over how elements align and flow across your page.

Grid represents a fundamental shift in how we approach web layouts. Unlike Flexbox's one-dimensional flow, Grid establishes a coordinate system where you can place elements with surgical precision. This makes it particularly valuable for complex layouts that need to adapt seamlessly across devices—a critical requirement in today's mobile-first world.

This brings us to a crucial distinction in modern web development: truly responsive design requires media queries, not just fluid layouts. While we've been creating mobile-optimized designs that scale smoothly, genuine responsiveness means strategically changing layout behavior at specific screen sizes. Media queries are the mechanism that makes this possible, allowing different visual treatments for different viewport conditions.

Let's examine a practical implementation. Our current layout performs well on mobile devices, but desktop users deserve a more sophisticated presentation. The challenge lies in creating a two-column desktop layout while maintaining the single-column mobile experience—without compromising either use case.

Right-click and inspect the current layout, then narrow your browser window to simulate mobile viewing. Notice how the typography feels oversized and the spacing inefficient on smaller screens. These aren't minor aesthetic issues—they directly impact user experience and engagement rates.

For larger screens, we can leverage horizontal real estate more effectively. A two-column approach would allow the education section to sit alongside work experience, creating better visual balance and reducing scroll fatigue. This kind of adaptive design thinking separates professional web development from amateur attempts.

Examining our HTML structure reveals three semantic sections within the main content area. Each section represents a distinct content category—statement of intent, work experience, and education. This semantic structure becomes our foundation for Grid-based layout control.

The parent-child relationship is crucial here. When we apply `display: grid` to the main element, its three section children become grid items automatically. This mirrors Flexbox's behavior but with far more sophisticated positioning options. Unlike Flexbox's linear flow, Grid lets us create complex layouts that would require multiple nested containers in older approaches.

Notice that each section has a unique ID alongside shared classes—a deliberate structural choice. While classes could work equally well, IDs emphasize the singular nature of each content area. The shared `primary-section` class provides consistent styling across all sections, demonstrating how modern CSS architecture balances specificity with maintainability.

Now for the implementation. First, we need to establish our grid container. Looking at the existing CSS, there's no main element styling yet, so we'll create it. Adding `display: grid` alone doesn't change the visual presentation—it simply activates Grid functionality, similar to how `display: flex` unlocks Flexbox properties.


The real power emerges with `grid-template-columns`. This property simultaneously defines column quantity and sizing. For our two-thirds/one-third layout, we'll use `2fr 1fr`—fractional units that represent proportional space allocation rather than fixed measurements.

Fractional units (fr) deserve deeper explanation because they're genuinely revolutionary. Unlike percentages, which require manual calculation, fractional units automatically handle the math. `2fr 1fr` means "give the first column twice the space of the second column." The browser calculates that 2+1=3 total parts, allocating 2/3 to column one and 1/3 to column two. This approach scales elegantly and simplifies responsive adjustments.

You could create more complex distributions—`1fr 2fr 1fr` would create three columns with the center one twice as wide as the outer columns. The system handles all proportional calculations automatically, making layout adjustments remarkably straightforward.

Adding `gap: 30px` creates consistent spacing between grid areas—both horizontally and vertically. Unlike margins or padding, gap only affects internal spacing between grid items, never adding unwanted space around the container's exterior. This precision is exactly what professional layouts require.

However, we now face a three-items-into-two-columns challenge. Grid automatically flows items into available cells, creating new rows when necessary. Our statement of intent sits in column one, work experience in column two, but then education wraps to a new row—not our intended design.

The solution lies in explicit grid placement. Using `grid-column: span 2` on the statement section forces it to occupy both columns. This pushes the remaining sections to the next row, where they naturally fill the two-column structure we defined. The result is a clean, intentional layout that maximizes content hierarchy.

This creates an excellent desktop experience, but it's problematic on mobile devices. Two narrow columns on a phone screen create cramped, unreadable content. This is where media queries become essential—allowing us to serve different layouts to different screen sizes without compromising either experience.

We also need to address the body margins. The current 20px margin works well on desktop but wastes precious screen real estate on mobile. A mobile-first approach means starting with no margins, then adding them back for larger screens.

Media queries follow a specific syntax: `@media (min-width: 700px)` creates a conditional block that only applies when the viewport meets the specified criteria. This particular query targets screens 700 pixels wide and larger. Choose breakpoints based on your content's behavior, not arbitrary device dimensions.


The mobile-first methodology means base styles target small screens, with media queries progressively enhancing the experience for larger viewports. This approach aligns with how browsers parse CSS and how users actually consume web content—mobile traffic has dominated desktop since 2016 and continues growing in 2026.

Inside our media query, we'll override specific properties for larger screens: body margins return to 20px, grid columns shift to `2fr 1fr`, and the statement section spans both columns. The heading size can also scale up—perhaps from 30px on mobile to 42px on desktop, improving hierarchy and visual impact.

The cascade order matters critically here. Media query rules must come after their base counterparts in the stylesheet. Both selectors have identical specificity, so source order determines which rule applies. The later rule overwrites the earlier one when the media query condition is met.

Testing responsive behavior requires proper tools. Browser window resizing provides basic feedback, but mobile simulation gives more accurate results. Modern browsers include device simulation tools that account for pixel density, touch interactions, and viewport meta tags—crucial factors that simple resizing can't replicate.

Breakpoint selection deserves strategic consideration. Rather than targeting specific devices, focus on when your content begins to look cramped or awkwardly spaced. Watch the browser's viewport indicator as you resize—when the layout starts feeling uncomfortable, that's your natural breakpoint. It might be 660px, 800px, or something entirely different based on your specific content and typography choices.

This approach scales beautifully beyond two breakpoints. Complex sites often use 3-4 media queries to optimize for phones, tablets, laptops, and large displays. Each breakpoint addresses specific usability challenges while building upon the previous layer's foundation.

The result is a genuinely responsive layout that serves users appropriately regardless of their device choice. On mobile, they get focused, scrollable content optimized for thumb navigation. On desktop, they get sophisticated multi-column layouts that leverage available screen space efficiently. This isn't just good design—it's good business, directly impacting engagement metrics and conversion rates.

One final consideration: always test your responsive layouts on actual devices when possible. Desktop simulation tools are excellent for development, but real-world testing reveals issues that even the best simulators miss. The investment in proper responsive testing pays dividends in user satisfaction and site performance.