Utopia
Tags: utopia, fluid, responsive, typography
Published: 2020-02-20 16:08:23

---
title: Utopia
published: true
date: 2020-02-18 18:03:46 UTC
tags: utopia,fluid,responsive,typography
canonical_url: https://adactio.com/journal/16442
---

[Trys](https://clearleft.com/about/team/trys-mudford) and [James](https://clearleft.com/about/team/james-gilyead) recently unveiled their [Utopia](https://utopia.fyi/) project. They’ve been tinkering away at it behind the scenes for quite a while now.

You can [check out the website](https://utopia.fyi/) and [read the blog](https://utopia.fyi/blog) to get the details of how it accomplishes its goal:

> Elegantly scale type and space without breakpoints.

I may well be biased, but I really like this project. I’ve been asking myself why I find it so appealing. Here are a few of the attributes of Utopia that strike a chord with me…

### It’s collaborative

Collaboration is at the heart of [Clearleft](https://clearleft.com/)’s work. I know everyone says that, but we’ve definitely seen a direct correlation: projects with high levels of collaboration are invariably more successful than projects where people are siloed.

The genesis for [Utopia](https://utopia.fyi/) came about after Trys and James worked together on a few different projects. It’s all too easy to let design and development splinter off into their own caves, but on these projects, Trys and James were working (literally) side by side. This meant that they could easily articulate frustrations to one another, and more important, they could easily share their excitement.

The end result of their collaboration is [some very clever code](https://utopia.fyi/generator). There’s an irony here. This code could be used to _discourage_ collaboration! After all, why would designers and developers sit down together if they can just pass these numbers back and forth?

But I don’t think that [Utopia](https://utopia.fyi) will appeal to designers and developers who work in that way. Born in the spirit of collaboration, I suspect that it will mostly benefit people who value collaboration.

### It’s intrinsic

If you’re a control freak, you may not like [Utopia](https://utopia.fyi/). The idea is that you specify the boundaries of what you’re trying to accomplish—minimum/maximum font sizes, minumum/maximum screen sizes, and some modular scales. Then you let the code—and the browser—do all the work.

On the one hand, this feels like surrending control. But on the other hand, because the underlying system is so robust, it’s a way of guaranteeing quality, even in situations you haven’t accounted for.

If someone asks you, “What size will the body copy be when the viewport is 850 pixels wide?”, your answer would have to be “I don’t know …but I _do_ know that it will be appropriate.”

This feels like a very declarative way of designing. It reminds me of the ethos behind [Andy](https://hankchizljaw.com) and [Heydon](https://heydonworks.com/)’s site, [Every Layout](https://every-layout.dev/). They call it algorithmic layout design:

> Employing algorithmic layout design means doing away with `@media` breakpoints, “magic numbers”, and other hacks, to create context-independent layout components. Your future design systems will be more consistent, terser in code, and more malleable in the hands of your users and their devices.

See how breakpoints are mentioned as being a very top-down approach to layout? Remember the tagline for Utopia, which aims for _fluid_ responsive design?

> Elegantly scale type and space without breakpoints.

Unsurprisingly, [Andy really likes Utopia](https://hankchizljaw.com/wrote/fluid-scale-and-tokens:-a-match-made-in-heaven/):

> As the co-author of [Every Layout](https://every-layout.dev/), my head nearly fell off from all of the nodding when reading this because this is the exact sort of approach that we preach: setting some rules and letting the browser do the rest.

Heydon describes this mindset as [automating intent](https://every-layout.dev/blog/algorithmic-design/). I really like that. I think that’s what Utopia does too.

[As Heydon said at Patterns Day](https://vimeo.com/345905639):

> Be your browser’s mentor, not its micromanager.
> 
> The idea is that you give it rules, you give it axioms or principles to work on, and you let it do the calculation. You work with the in-built algorithms of the browser and of CSS itself.

This is all possible thanks to improvements to CSS like `calc`, flexbox and grid. [Jen](https://jensimmons.com/) calls this approach intrinsic web design. Last year, I liveblogged her excellent talk at An Event Apart called [Designing Intrinsic Layouts](https://adactio.com/journal/14889).

[Utopia](https://utopia.fyi/) feels like it has the same mindset as algorithmic layout design and intrinsic web design. Trys and James are building on the great work already out there, which brings me to the final property of Utopia that appeals to me…

### It’s iterative

There isn’t actually much that’s new in [Utopia](https://utopia.fyi/). It’s a combination of existing techniques. I like that. [As I said recently](https://adactio.com/journal/16411):

> I’m a great believer in the HTML design principle, [Evolution Not Revolution](https://www.w3.org/TR/html-design-principles/#evolution-not-revolution):
> 
> > It is better to evolve an existing design rather than throwing it away.

First of all, [Utopia](https://utopia.fyi/) uses the idea of [modular scales](https://www.modularscale.com/) in typography. [Tim Brown](https://tbrown.org/) has been championing this idea for years.

Then there’s the idea of typography being fluid and responsive—just like [Jason Pamental](https://rwt.io/) has been speaking and writing about.

On the code side, [Utopia](https://utopia.fyi/) wouldn’t be possible without the work of [Mike Reithmuller](https://www.madebymike.com.au/) and his breakthroughs on [responsive](https://www.madebymike.com.au/writing/precise-control-responsive-typography/) and [fluid](https://www.madebymike.com.au/writing/fluid-type-calc-examples/) typography, which led to Tim’s work on [CSS locks](https://blog.typekit.com/2016/08/17/flexible-typography-with-css-locks/).

[Utopia](https://utopia.fyi/) takes these building blocks and combines them. So if you’re wondering if it would be a good tool for one of your projects, you can take an equally iterative approach by asking some questions…

#### Are you using fluid type?

Do your font-sizes increase in proportion to the width of the viewport? I don’t mean in sudden jumps with `@media` breakpoints—I mean some kind of relationship between font size and the `vw` (viewport width) unit. If so, you’re probably using some kind of mechanism to cap the minimum and maximum font sizes—CSS locks.

I’m using that technique on [<cite>Resilient Web Design</cite>](https://resilientwebdesign.com/). But I’m not changing the _relative_ difference between different sized elements—body copy, headings, etc.—as the screen size changes.

#### Are you using modular scales?

Does your type system have some kind of ratio that describes the increase in type sizes? You probably have more than one ratio (unlike [<cite>Resilient Web Design</cite>](https://resilientwebdesign.com/)). The ratio for small screens should probably be smaller than the ratio for big screens. But rather than jump from one ratio to another at an arbitrary breakpoint, [Utopia](https://utopia.fyi/blog) allows the _ratio_ to be fluid.

So it’s not just that font sizes are increasing as the screen gets larger; the comparative difference is also subtly changing. That means there’s never a sudden jump in font size at any time.

#### Are you using custom properties?

A technical detail this, but the magic of [Utopia](https://utopia.fyi/) relies on two powerful CSS features: `calc()` and custom properties. These two workhorses are used by Utopia to [generate some CSS](https://utopia.fyi/generator/) that you can stick at the start of your stylesheet. If you ever need to make changes, all the parameters are defined at the top of the code block. Tweak those numbers and watch everything cascade.

You’ll see that there’s one—and only one—media query in there. This is quite clever. Usually with CSS locks, you’d need to have a media query for every different font size in order to cap its growth at the maximum screen size. With [Utopia](https://utopia.fyi/), the maximum screen size—`100vw`—is abstracted into a variable (a custom property). The media query then changes its value to be the upper end of your CSS lock. So it doesn’t matter how many different font sizes you’re setting: because they all use that custom property, one single media query takes care of capping the growth of every font size declaration.

If you’re already using CSS locks, modular scales, and custom properties, [Utopia](https://utopia.fyi/) is almost certainly going to be a good fit for you.

If you’re not yet using those techniques, but you’d like to, I highly recommend using [Utopia](https://utopia.fyi/) on your next project.