惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
D
Docker
C
Check Point Blog
P
Proofpoint News Feed
H
Help Net Security
A
About on SuperTechFans
GbyAI
GbyAI
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
U
Unit 42
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
I
InfoQ
Recent Announcements
Recent Announcements
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
Simon Willison's Weblog
Simon Willison's Weblog
WordPress大学
WordPress大学
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
C
CXSECURITY Database RSS Feed - CXSecurity.com
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
Help Net Security
Help Net Security
P
Proofpoint News Feed
Latest news
Latest news
L
LINUX DO - 最新话题
K
Kaspersky official blog
B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
C
Cyber Attacks, Cyber Crime and Cyber Security
Project Zero
Project Zero
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
H
Heimdal Security Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
Jina AI
Jina AI
Vercel News
Vercel News
AWS News Blog
AWS News Blog
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 【当耐特】
Hacker News - Newest:
Hacker News - Newest: "LLM"
W
WeLiveSecurity
Martin Fowler
Martin Fowler

Utopia

Fluid responsive typography: easy when you know how Utopian project kickstarter: designing a fluid responsive website in a static tool like Figma Generate all pair permutations in Utopia SCSS Type scale graphs Figma plugin and kickstarter V2 Readable clamp() with PostCSS Utopia Utopia SCSS library Clamp calculator Utopia Fluid Type + Space Calculator now supports Figma variables Designing a Utopian layout grid: Working with fluid responsive values in a static design tool. Getting started with Utopia Figma Plugins A video introduction to Utopia Painting with a fluid space palette Designing with a fluid space palette Clamp Dealing with negativity in fluid type scales Fluid custom properties CSS-only fluid modular type scales Designing with fluid type scales
Utopian CSS generator, an iteration
dev@clearlef · 2020-09-09 · via Utopia

We've just published a second generator for Utopia.

The initial controls are the same as the first, you control the viewport, base size and type scale for your minimum and maximum target screens, and the generator will provide project-ready CSS.

Originally, the idea of leaving the configurable options within the :root declaration seemed ideal; it allowed you to tweak the parameters without recalculating each time. And for type scale purists, or for when you're starting out on a project, that may well still be the best option - we don't plan on sunsetting that generator.

But having applied these Utopian principles to a few more projects, we were finding we wanted a little more control over each step in the scale.

Take this scale:

Step Min Max
0 19.00 22.00
1 22.80 26.40
2 27.36 31.68
3 32.83 38.02
4 39.40 45.62
5 47.28 54.74
6 56.73 65.69
7 68.08 78.83

It uses a variable base size of 19-22px, but a fixed minor third type scale of 1.2. This gives us subtle shifts between font sizes; step 5 only shifts 7px between the two breakpoints. This is perfect if you need a slow ramp up to larger sizes, but does have a downside. If you're after a nice chunky heading size (let's say step 7 rounding out at 78.83px), you have to accept that it'll be 68px on the smallest screen. That's generally too large on a mobile device, leaving you with overflowing or wrapping words.

The original generator baked those two values into a complex calculation, making it hard to unpick. The new generator -calculates the values for each step within the Utopia website, but leaves them tweakable in your codebase:

--f-7-min: 68.08;
--f-7-max: 78.83;
--step-7: calc(((var(--f-7-min) / 16) * 1rem) + (var(--f-7-max) - var(--f-7-min)) * var(--fluid-bp));

Overriding the steps

With the new generator, you can now bring that minimum value down to something a bit more reasonable. Be aware, by doing this, you are in effect changing the type scale for this step, so the rhythm between each step will be altered.

The first option is to manually change the minimum, say to 50px:

--f-7-min: 50;
--f-7-max: 78.83;
--step-7: calc(((var(--f-7-min) / 16) * 1rem) + (var(--f-7-max) - var(--f-7-min)) * var(--fluid-bp));

But that's pretty arbitrary. It would be better if we could keep things systematic. Thanks to custom properties, you can feed the 'output' of another step, into the input of this step:

/* Start at the same point as step 5 */
--f-7-min: var(--f-5-min);

/* Start at step 4's end point */
--f-7-min: var(--f-4-max);

Why another generator?

The original generator prioritised the integrity of the type scales, which still works well for certain projects. This new generator introduces a layer of flexibility, removing restrictions without sacrificing the entire system. Utopia is an 'opinionated' methodology, that sets sensible foundations for your responsive web projects; this iteration exposes those opinions for you to tweak to taste.