Read Medium logo
No Results
Translate to
Read Medium Logo
Free OpenAI o1 chatTry OpenAI o1 API
Read Medium logo
No Results
Translate to
avatarT O U H E Y

Summary

The article discusses the nuances of using hard and soft grids in design, particularly within O'Reilly's design system, and evaluates their impact on consistency and alignment in both design and development.

Abstract

The author, while peer-reviewing a design for O'Reilly's design system, encountered discrepancies in vertical spacing despite both designers using an 8px baseline grid. This led to a deeper exploration of grid systems, specifically the use of hard and soft grids. The hard grid method involves aligning design elements strictly to the grid, while the soft grid method allows for more flexibility, mirroring the development environment. The article details the author's experimentation with both methods, using 8pt and 4pt grids, and the challenges faced in measuring and maintaining consistency across design and development teams. The author concludes with a reflection on the importance of aligning text objects to line-height calculations and the potential benefits of adopting a soft grid approach for the O'Reilly design team, while acknowledging the need for further investigation into developer preferences and implementation accuracy.

Opinions

  • The author suggests that the choice between hard and soft grids can significantly affect the alignment and spacing of design elements.
  • There is an emphasis on the importance of designers and developers using consistent measurement methods to ensure design fidelity in implementation.
  • The author leans towards the soft grid method due to its alignment with development practices and its flexibility in handling various design elements.
  • The article highlights the potential for a 4px baseline grid to offer better alignment for text elements, especially when dealing with complex layouts.
  • The author points out that relying on baseline grid overlays for measurements can lead to inaccuracies and recommends focusing on object line-heights and direct selection measurements instead.
  • The author expresses surprise at Zeplin's lack of measurement capabilities for text objects and encourages users to advocate for improvement.
  • The author values the feedback and experiences of other design teams in navigating the challenges of grid systems in design.

The bottom line on measuring hard and soft grids, Part I

I was recently conducting a peer review for some design explorations of a component for O’Reilly’s design system. During the review, I noticed that some of the vertical spacing seemed “off”. After further discussion with the designer, we came to the sneaking suspicion that we might be measuring designs in different ways.

Even though we were both utilizing the same 8px baseline grid, we were getting very different results.

In the midst of that conversation, my colleague said; “So we’re actually using a 4px baseline grid, not 8.” That really got me thinking. Had we set up our grid templates for failure? Would changing everything to a 4px baseline correct the issues we were seeing? I really wasn’t sure so I started doing some research to find out.

The first place I referenced was an article I had bookmarked some time ago. This post by Spec gives a comprehensive overview of the 8pt grid system which highlights a crucial and often overlooked part of designing with the baseline grid: using “hard” or “soft” grids. Reading that post was a bit of an aha! moment. On the surface, it appeared that declaring “hard” or “soft” would address the major issue we were facing and that it was less about the setup of the baseline grid settings. To validate that I would need to put both methods to the test to see how they work in the real world and compare them with our current designs.

To start, let’s look at the arguments for each:

“Hard Grid”

You can use oddly sized elements within a design and just reduce/increase the size of the surrounding block element to fill the space within the grid structure.

“Soft Grid”

This mirrors the development environment more closely because programming languages don’t adhere to a hard grid structure.

“Don’t get hung up on the word “Grid” too much, when talking about a Soft Grid. It’s really more about a fixed sizing/spacing increment (8px in this case) of the elements relative to each other.” ~Anthony Collurafici

I embarked on a mission to analyze these methods with the hope of finding a solution that would get the O’Reilly design team closer to reaching our primary goal: To find a consistent method of measurement for both design and development.

To break that down even further, that means that the proposed solution would ideally:

  • Enable any designer to pick up where someone else left off and produce the same spacing results
  • Enable any front-end developer to reference a design and ingest the same outputs as their counterparts

Hard

The first exercise I performed was laying out a sample card component using the Hard method with both an 8pt and 4pt baseline grid.

Laying out a card component using both the 8px and 4px hard grid method.

Observations

  • The top-left icon/text element has an object height of 20px because we’re following Material Design which allows icons to be sized in increments of 4px. I decided to align only the text portion of the group (“video”) to the baseline even though I had a bounding box area that was off-grid (see bubble callout in the second column).
  • While the 4px baseline grid settings were noisier to look at while designing, it allowed for better flexibility in visual alignment of text without the need to nudge. Even with a pre-set nudge setting, you can sometimes get lost in more complex layouts which requires you to reset your text on the baseline and nudge again. I’m a bit OCD, so I liked seeing everything fit cleanly on the lines.
  • You still have to do some math to make sure objects besides icons and text are divisible by 8.

Next, I used a few common methods to extract measurements from each layout.

Testing a few common measuring methods of the 8px hard layout.

Observations

  • Manually highlighting rows to declare the height and distance between objects provides accuracy but could be a burden to scale.
  • Measurements in Sketch (using direct selection) and InVision Inspect are only as good as your text field height settings. Even if your text line-height is 20px, inspectors read the text container height when selecting objects which could be set to a different value (e.g. 44px), throwing off the output. This forces you to check your line-height settings and confirm the math based on the number of rows of text (example: line-height of 20px *2 rows of text = bounding box height of 40px).
  • 4px baseline conforming elements such as a 20px icon threw off measurements, producing values such as 10px instead of 8px.
  • Baseline measurements are pointless when following the hard grid method.

Soft

I’m generally a fan of soft grid layouts and respecting the code as a source of truth. I will use spacing elements in my files to help layout a baseline grid but I generally just measure element to element. I use the 8pt grid as a relative spacial system, not a strict grid. ~Elliot Dahl

So how do you measure between a variety of elements using a soft grid?Elliot Dahl talked about this in 8-Point Grid: Vertical Rhythm

A big takeaway from Elliot’s post was the need to choose between measuring from the baseline or from the line-height. This was my second aha! moment.

Using the same example design, I recreated the layouts following the soft grid method with both an 8pt and 4pt baseline grid.

Laying out a card component using both the 8px and 4px soft grid method.

Typography can be placed outside of the 4dp grid when it’s centered within a component, such as a button or list item. ~Google Material Design

Observations

  • I turned off my grid overlay when laying out the icons and text within the component and just relied on the direct selection of elements and space between to produce the final output.
  • A 4px baseline grid did not provide any extra value in this specific use case because all of my icons/text were within a component. I thought card components might be considered a special case and adhere more strictly to the baseline, but I couldn’t find anything specific on the subject. “Cards have no singular layout, typographic, or image size. All cards should be designed to meet the needs of the content they present.” ~Google Material Design
  • The same precautions about bounding box height and line heights still apply to this (see previous observations).

I applied the same methods of measurement I had previously used for the 8px hard layout to the “soft” layouts.

Testing a few common measuring methods of the 8px soft layout.

Observations

  • Trying to manually redline specs when using soft increments of 4px created odd spacing when using the 8px baseline grid overlay settings.
  • Sketch and InVision Inspect produced clean, matching specs. Yay!
  • Baseline measurements don’t make sense here because the icon and text elements were not being measured from the baseline in Sketch (Ctrl+Opt).

“…Getting a web browser to measure from the baseline will be tricky. You’ll have to design based on the baseline and then use highly specific spacings to get your content to line up. This will become difficult to maintain and I would not recommend it for large design systems with a lot of surface area.” ~Elliot Dahl

Conclusions

  • I’m somewhat conflicted about whether or not to start using a 4px baseline grid setting for layouts in Sketch. It didn’t provide much value in this exercise with a component, but setting type or complex data sets within a page might be useful.
  • It’s critical to ensure your text object (bounding box) heights match your text line-height calculations to ensure proper output.
  • Relying on the 8px baseline for laying out images and containers works well.
  • Relying on the object/line-height of objects and ignoring the 8px baseline grid overlay when laying out icons/text within a component resulted in cleaner measurements when inspecting.
  • Providing measurements by the baseline in Sketch produces decimal values and would require a lot more work to get right across a team.
  • I’m leaning towards promoting the 8/4px Soft approach based on the output of this test, but I want to do some further comparisons with the 8/4px Hard method, specifically in regards to developer preference and truth in implementation.

Keep in mind there is more to consider when choosing between hard and soft grids:

  • Which baseline grid settings are you using (e.g. 4, 8, none, etc.)?
  • Is your design team working from an established design system or style guide with pre-defined type styles that have line-heights matching the baseline grid units (e.g. 16/24px)?
  • Do all designers on your team use the same digital production tool (e.g. Sketch, Studio, XD, etc.)?
  • Is everyone on your team using the same method/tool for referencing measurements in designs? (Source file, InVision Inspect, Sketch Measure, etc.)
  • How are your front-end teams translating measurements in CSS?

Up Next, Part II

I’m working on the second half of this post which will cover communicating and translating these results into a front-end development environment. Stay tuned.

As always, I’d love to hear your feedback and understand how other teams are approaching this issue.

Resources

Baseline Grid

Spec · 8-Point Grid

Using multiples of 8 to define dimensions, padding, and margin of elements

spec.fm

Intro to The 8-Point Grid System

Learn how it can take your design to the next level

builttoadapt.io

8-Point Grid: Vertical Rhythm

The 8-point grid is a powerful system for creating consistent and visually appealing user interfaces (UIs). This post…

builttoadapt.io

8pt Material Design GUI Templates

A walk-thru of Design Inc.’s visual design & base metrics

medium.com

Spacing methods

This section discusses the usage of keylines, padding, incremental spacing, ratios and touch targets.

material.io

Typesetting

Typesetting in Sketch

undefined

undefined

Why is Vertical Rhythm an Important Typography Practice? | Zell Liew

You probably heard of the term **Vertical Rhythm** if you researched a little about typography on the web. It's one of…

zellwk.com

Sketch

Measuring

Sketch is a design toolkit built to help you create your best work - from your earliest ideas, through to final…

sketchapp.com

Sketch Workflow — 8 point Soft Grids

I wanted to share my Sketch workflow designing on an 8 point soft grid. If you are not familiar with this concept…

medium.com

Note: I attempted to use Zeplin as a point of comparison for this post because several members of our team use it, however, I was shocked to find that it did not provide any measurements between text objects which just seems crazy to me. If you use this tool please contribute to this open feature request thread.

O’Reilly’s hiring

We’re currently looking for smart product designers and front-end developers to help build the future of our online learning platform. Send me a tweet or DM me touhey if you’re interested in joining our growing design team.

Product Design
Grid
UX
Design Process
Material Design
Recommended from ReadMedium
avatarChristie Tang
Responsive grids and how to actually use them

A detailed explanation for designers on how to use grids for responsive design, and how things will scale in between breakpoints.

11 min read
avatarSouptik Debnath
UI Design Trends In 2025

Designing for 2025 isn’t just about hopping on the latest trends — it’s about creating experiences that truly matters the most. As the…

5 min read
avatarMelody Koh 🤔
Your portfolios are fucking boring

Sincerely, every design hiring manager out there

9 min read
avatarJessica Stillman
Jeff Bezos Says the 1-Hour Rule Makes Him Smarter. New Neuroscience Says He’s Right

Jeff Bezos’s morning routine has long included the one-hour rule. New neuroscience says yours probably should too.

4 min read
avatarIssara Willenskomer
Creating Usability with Motion: The UX in Motion Manifesto

The following manifesto represents my answer to the question — “As a UX or UI, designer, how do I know when and where to implement motion…

21 min read
avatarMichal Malewicz
Figma is not forever.

And inVision is now gone.

4 min read