<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ethan Wang on Medium]]></title>
        <description><![CDATA[Stories by Ethan Wang on Medium]]></description>
        <link>https://medium.com/@SashimiEthan?source=rss-8779048a9915------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DXthOzmlZn_WfdwuvYT22g.jpeg</url>
            <title>Stories by Ethan Wang on Medium</title>
            <link>https://medium.com/@SashimiEthan?source=rss-8779048a9915------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:33:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SashimiEthan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Leading-Trim: The Future of Digital Typesetting]]></title>
            <link>https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202?source=rss-8779048a9915------2</link>
            <guid isPermaLink="false">https://medium.com/p/d082d84b202</guid>
            <category><![CDATA[typography]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Ethan Wang]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 15:01:02 GMT</pubDate>
            <atom:updated>2020-08-18T15:54:58.051Z</atom:updated>
            <content:encoded><![CDATA[<h4>How an emerging CSS standard can fix old problems and raise the bar for web apps</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1n5TVDGqRvUUNXWH07LWDA.png" /></figure><h3><strong>The problem with text boxes today</strong></h3><p>In a standard text box, there’s almost always extra space above and below the actual text. Because of this, when you use a text box to measure and implement spacing, it ends up larger than you intended. The bigger the line height, the bigger the problem. The example below shows distances between text boxes set to 32px. As you can see, all the vertical spacing is visually much bigger than 32px, even though you set them all to the same value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8Tw0At-1CTZa3Bx7-NQjA.png" /></figure><p>This is a common problem that spans tools and platforms. In <a href="https://uxdesign.cc/the-4px-baseline-grid-89485012dea6">my last Medium article</a>, I talked about how I use the 4px baseline grid to measure spacing around text and achieve better visual accuracy. Knowing the imperfections of this approach, I kept searching for a better solution. Last June, I came across an emerging CSS feature spec called leading-trim. I’ve been working with the author of the spec, an expert from the W3C CSS Working Group, <a href="https://twitter.com/fantasai">fantasai</a>, to make sure Microsoft Design can be a part of this transformative work.</p><p>Today, we’re excited to announce that Microsoft Design is sponsoring the authoring of this new spec. This article gives an introduction to this new CSS standard, leading-trim, and what it could mean for web designers and developers.</p><h3><strong>How we got here: a history lesson</strong></h3><p>To understand how this became a problem, specifically on the web, we need to go back in the history of typography. Around 140 years ago, type was still set manually with individual lead boxes. To make text more readable, typesetters would put strips of lead to space lines out. (That’s where the word “leading” came from 😉) The height of the type block plus the leading add up to the total line height.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3NewpqUSDBwwOgvyP_5Lw.png" /></figure><p>Early graphic design software in the ’80s kept the same tradition where people could add bottom leading directly to control spacing between lines, and line height would increase as a result. Other software made it a two-way street, where people could adjust the line height directly. But behind the scenes, bottom leading was always the part that was changing.</p><p>Things diverged after the invention of the web, with CSS1 debuting in 1996. The people who created CSS1 decided to split leading in half and put it above and below each line. They called it “half-leading.” Their reason was simple: make text boxes looks even.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOVTihkwHA80Ij06N_Ylzg.png" /><figcaption>Leading was split in half and put above and below each line since CSS1. The browser window shown above is Internet Explorer 3.0. IE3 was the first commercial browser with CSS support. The font used is Verdana, released with the <a href="https://en.wikipedia.org/wiki/Core_fonts_for_the_Web">Core Fonts for the web</a> project initiated by Microsoft back in 1996. In case you are wondering, the curves in the browser chrome are not a watermark.</figcaption></figure><p>While half-leading creatively avoided uneven bounding boxes, it introduced its own problems. Each font size in a font family comes with a default line height. Default line height is usually designed to be taller than the text it contains to accommodate certain characters and accent signs. Increasing line height then adds two half-leadings, making the text box even bigger. Half-leading, together with the extra space reserved in the default line height, is the root of our text box frustrations today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyWzyospTb3msbEoRUQNvg.png" /><figcaption>The anatomy of your average text box</figcaption></figure><h3>Workarounds are just workarounds</h3><p>Some of our most popular UI design tools, such as Figma and Sketch, seem to have adopted the half-leading model and render text this way. So we experience this problem in both our design tools and browsers.</p><p>The workaround on the design side is relatively easy: you can ignore the bounding box and directly measure space against text’s cap height and baseline. It’s a manual process because most design tools don’t have snap targets for cap height and baseline, but I know we designers will do anything to make our design look good!</p><p>But if we take this approach, developers still implement only the bounding box spacing in CSS. Therefore, they would get seemingly random spacing values.</p><p>To mitigate this randomness issue, developers can “crop” the text box in CSS with negative margins. But the negative margins would need to be determined manually and are font specific, and therefore “random.” Any font, browser, operating system or locale change will inevitably throw off your carefully set margins. Besides, this technique is generally not a good coding practice and can cause unintended side effects.</p><h3>Introducing leading-trim</h3><p>Leading-trim seeks to change the standard we’ve been using for <strong>24 years</strong>.</p><p>Leading-trim is a new CSS property that the CSS Working Group is introducing. Just as the name suggests, it works like a text box scissor. You can trim off all the extra space from reference points of your choice with just two lines of CSS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gXfB7QR3LpWwJEuA12drqw.gif" /></figure><pre>h1 { <br> text-edge: cap alphabetic;<br> leading-trim: both;<br>}</pre><p>The example above first uses text-edge (also a new property) to tell the browser the desired edge of the text is the cap height and the alphabetic baseline. Then it uses leading-trim to trim it from both sides. Note that leading-trim only affects the text box; it doesn’t cut off the text within it.</p><p>These two simple lines of CSS create a clean text box that hugs your text. This helps you achieve much more accurate spacings and create a better visual hierarchy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5hCFrGPhc98PnSlUIVnzg.png" /></figure><h3><strong>Leading-trim fixes alignment issues</strong></h3><p>With leading-trim, you can finally fix all the mysterious alignment issues you see on your site. For example, maybe your text doesn’t always look vertically centered in a container even though the text box is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*dpO-Wj1WJkUhfMJo6b16Nw.png" /></figure><p>The extra space reserved in the default line height causes text to not always be centered in the text box. With leading-trim, you can reliably vertically center your text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*02Egg4eeYDl_Id7nTAXxnA.png" /></figure><p>Each font is also designed differently. It comes with its own default line height and the text within it could have a different size and baseline position. So sometimes even if font size, line height, and text box position stay the same, changing the font changes the alignment of the text, just like the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*jrMbEmh8SJ_YRjE3ua1dkA.png" /></figure><p>In the second example, you can see how leading-trim prevents this and keeps the text true to form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*BCMCmx32M4SSu_elWkhXCA.png" /></figure><h3><strong>Other immediate impacts: consistency and workflow improvements</strong></h3><p>Leading-trim goes beyond making spacings and alignment more accurate. It plays a key role in enabling an <strong><em>accurate </em></strong>spacing system, paving the way for design accuracy and consistency and efficient design-to-dev handoff.</p><p>A spacing system is like t-shirt sizes for spacing values. Like how a color palette or type ramp is set up in code today, spacing values can also be represented using CSS classes. (To learn more about spacing systems, check out <a href="https://medium.com/u/799c7c7840a">Nathan Curtis</a>’s <a href="https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62">Space in Design System</a>.)</p><p>There are a lot of benefits to having a spacing system. Designers can make spacing decisions faster, and developers can set up corresponding spacing variables to eliminate random, hard-coded values in code. But today, even if we set up a spacing system, it wouldn’t be accurate for text elements because of the extra space in the text box. If we try to ignore the bounding box in our design and “crop” the text box in code, we run into those tricky workaround issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOSIniYh3XWJTjQYCdKzOA.png" /><figcaption>A spacing system applied to text elements without leading-trim 😕</figcaption></figure><p>With leading-trim, designers can finally unlock the power of a spacing system. Starting from design, we can apply a spacing system on top of measuring optical spacing (measure against type’s cap height and baseline). In addition to accurate spacings, it will help us establish better visual hierarchies and have more confidence in our layout.Overall, we can improve design consistency across the board.</p><p>The design-to-dev handoff process will also be much smoother because developers will be able to set up the exact same system and avoid spending tons of time on layout bugs. Most importantly, the spacing systems leading-trim enables will help us deliver more visually polished products that our users trust and enjoy.</p><h3><strong>Small change, big implications</strong></h3><p>Beyond craftsmanship and making handoff more efficient, we hope leading-trim will turn a new page for digital typesetting, eventually motivating improvements to other standards and platforms, starting with OpenType.</p><p>Leading-trim works by browsers accessing the font metrics to find, for example, the cap height and baseline. As the standard font format, OpenType specifies what metrics to include in the font file. OpenType has been jointly developed by Microsoft and Adobe as an extension of Apple’s TrueType font format since 1997. While today OpenType has robust support for Latin scripts and CJK languages, it still lacks key metrics for other less commonly used writing systems such as Hebrew or Thai. As people adopt leading-trim, we hope this leads the way for us to add more font metrics of other writing systems to OpenType.</p><p>Ultimately, we hope leading-trim helps improve OpenType and its internationalization by ensuring equal typographical capabilities across the world. That’s just the start of the ecosystem. Once leading-trim becomes available in all the modern browsers, desktop applications that are built using web technologies, such as Figma, Teams, and VS Code, will also be able to utilize it.</p><p>The impact can also go beyond the web. Sketch has already added snap targets for cap height and baseline. Instead of holding down the Option key to show bounding box to bounding box spacing, you can hold down Control + Option to see baseline to cap height spacing. It makes measuring optical spacing a lot easier. More importantly, this shows the slow shift in the way people approach digital typesetting. We are hoping leading-trim can further encourage this change. And through this mindset change, beyond just snap targets, leading-trim might just become a new text rendering standard in our design tools and extend to our operating systems.</p><h3>Microsoft’s role in this effort</h3><p>Leading-trim is a part of the <a href="https://www.w3.org/TR/2020/WD-css-inline-3-20200618/">CSS Inline Layout Module Level 3</a> specification that fantasai is working on. There are four other proposals included in the spec with a common goal of fixing CSS text layout.</p><p>Microsoft Design is sponsoring the authoring of this spec as the first step of CSS standardization. The spec will provide the blueprint for each browser to implement so web developers and designers around the world can use the features it introduces. But we hope our involvement goes beyond that, from extending the OpenType specification to browser implementation, product integration and testing, and more.</p><p>We believe that this new specification will help move the needle in accessibility, internationalization, and craftsmanship, and we are extremely proud to be part of this initiative.</p><p>We look forward to the partnership with the CSS Working Group and fantasai, the cross-team collaboration that will happen across Microsoft, and are excited about what the future holds.</p><h4>Special thanks</h4><p>I’d like to extend a special thanks🎉 to my content designer, <a href="https://medium.com/u/2798f3b26a37">Perry Holzknecht</a> and my manager <a href="https://medium.com/u/3b27df1a58b1">Annie Bai</a> for their help and support along this journey. I would also like to thank <a href="https://medium.com/u/898c42fe51c9">Jonah Sterling</a> (our General Manager for Cloud+AI Studio), his design leadership team, and <a href="https://www.instagram.com/_anaarriola_/">Ana Arriola</a> (General Manager &amp; Partner for AI Product Design &amp; UX Research, NeXT.lab) for their help and guidance throughout this process. Thank you so much🎉 for making this happen!</p><p>And last, but not least, a huge thank you🎉 to Brook Durant (Senior Design Manager at Web Experience Collective (WXC) Studio) and <a href="https://medium.com/u/2d1179eb367d">Albert Shum</a> (CVP of Design for WXC Studio) for sponsoring this effort!</p><h4>Questions or comments?</h4><p>Please don’t hesitate to let me know if you have any questions or comments. Additionally, fantasai is also welcoming feedback on the <a href="https://www.w3.org/TR/2020/WD-css-inline-3-20200618/">CSS Inline Layout Module Level 3</a> spec in the <a href="https://github.com/w3c/csswg-drafts/issues">CSSWG’s GitHub repository</a>.</p><h4>Reference</h4><p><a href="https://medium.com/u/b55535a4ac78">Marcin Wichary</a>’s Figma blog post <a href="https://www.figma.com/blog/line-height-changes/">Getting to the bottom of line height in Figma</a> gave me the knowledge and inspiration that led me on this journey. I highly recommend reading it!</p><p><em>To stay in the know with Microsoft Design, follow us on </em><a href="http://www.twitter.com/microsoftdesign"><em>Twitter</em></a><em>, </em><a href="http://www.instagram.com/microsoft.design"><em>Instagram</em></a><em>, </em><a href="http://www.facebook.com/microsoftdesign"><em>Facebook</em></a><em> or join our </em><a href="https://insider.windows.com/"><em>Windows Insider program</em></a><em>. And if you are interested in joining our team at Microsoft, head over to </em><a href="http://aka.ms/designcareers"><em>aka.ms/DesignCareers</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d082d84b202" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202">Leading-Trim: The Future of Digital Typesetting</a> was originally published in <a href="https://medium.com/microsoft-design">Microsoft Design</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 4px baseline grid — the present]]></title>
            <link>https://uxdesign.cc/the-4px-baseline-grid-89485012dea6?source=rss-8779048a9915------2</link>
            <guid isPermaLink="false">https://medium.com/p/89485012dea6</guid>
            <category><![CDATA[visual-design]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[t]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Ethan Wang]]></dc:creator>
            <pubDate>Wed, 29 May 2019 17:31:01 GMT</pubDate>
            <atom:updated>2020-08-18T18:49:05.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JkmDuiUu5QoQRIB3yYolcw@2x.jpeg" /></figure><h3>The 4px baseline grid — the present</h3><h4>I’ve been using the 4px baseline grid for 2+ years now and have been trying to get my team to use it as well. I finally overcame my procrastination and decided to talk about it in my first Medium article. I’m looking for feedback on this method, so please let me know your thoughts! Here goes nothing.</h4><h3>The problem</h3><p>It drives me crazy that the text bounding box almost always brings in extra space above and below the actual text. Therefore, when the bounding box is used to measure space, it ends up being bigger than you intended. The bigger the line height, the bigger the problem. In the example below, the design was created by measuring the space between bounding boxes. When all the spacing is set to 32px (in the 1st card), visually all the vertical spacing is actually much bigger than 32px (as shown in the 2nd card), even though you meant them to be equal by setting them all to 32px.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MT1pn5ncq6G5Lto1FRspSA@2x.png" /><figcaption>Photo by <a href="https://unsplash.com/photos/VlVhOro5tf4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Max Delsid</a> on <a href="https://unsplash.com/search/photos/seattle?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>The solution</h3><p>Because of this problem, I use the 4px baseline grid to achieve a better visual accuracy. Here’s my process:</p><ol><li>I set up a 4px grid in the background</li><li>I snap all the UI elements and <strong>text baselines</strong> to the baseline grid</li><li><strong>I use the grid to measure vertical space around text instead of using the text’s bounding box.</strong> Specifically, I measure space above text from the grid line that’s closest to the type’s cap height and space below text from the text’s baseline</li><li>Additionally, I defined a set of spacing values for our team to use, inspired by this Medium article: <a href="https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62">Space in Design Systems</a> by <a href="https://medium.com/u/799c7c7840a">Nathan Curtis</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkimOwOqN7g4ev0qepnITA@2x.png" /></figure><p>In order for all the baselines to sit on the grid, this approach essentially rounds the visual height of the text (cap height to baseline) to a multiple of 4px (shown in the gif below). This could introduce a 1–2px error; however, it’s still more accurate than using the bounding box to decide spacing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-cd9PiJECApKIKYr4Dkmw.gif" /><figcaption>Measure space above the text from the closest grid to the cap height.</figcaption></figure><p>There is an exception: I vertically center icons or text within a component or container regardless of whether they sit on the baseline grid or not, because most of the time developers can use flexbox to center an element, and that is easier than using static spacing to do centering, for both parties 😉.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*F0XgEwIP-AqqUJiuB4wWRw@2x.png" /><figcaption>The text in each table row is centered using the “Align layer to middle” command in Sketch, and it’s okay that the baseline doesn’t snap to the grid.</figcaption></figure><h3>The why</h3><p>The baseline grid has traditionally been used in print design to create vertical rhythm. In my day to day work designing web experiences, I haven’t encountered that many use cases where such rhythm was obviously needed to make the alignment better.</p><p>To me, using the 4px baseline grid is a balance between visual accuracy (for users) and design efficiency (for me). In the Problem section, I talked about how measuring from text bounding box would introduce extra space. At the end of the day, user can’t see the bounding box. So it doesn’t really make sense to use this approach especially if it creates visual imbalance and doesn’t benefit users. On the other hand, ignoring the bounding box and measuring using the baseline grid is able to achieve better visual accuracy. See below for a comparison between these two approaches. As we can see, when the same set of spacing values (32px, 12px, 32px, 32px) is being used, the design measured using the baseline grid reflects the intended spacing much more accurately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*Kj12Nm-rgwHkGXQiypGulw@2x.png" /></figure><p>One might say, if measuring from the bounding box yields too much space, then for example in the first card, reducing the first spacing value from 32px to 28px or 24px would make “Seattle”’s top and left padding look equal. But at that point, it becomes a guessing game; you would never know for sure unless you count the pixels. On the other hand, the 4px grid approach provides a more accurate and predictable way to know it’s ~32px (taking into account the 1–2px error introduced by rounding).</p><p>In terms of design efficiency, this might seem like more work, but because of the grid, the design tool (Sketch or Figma) can help snap elements and type baseline to the grid, so aligning and spacing become relatively easy. Below is my workflow using the baseline grid to lay out text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRgCv9BK9HuOW3ggGSLLMg.gif" /><figcaption>My workflow using the baseline grid to lay out text.</figcaption></figure><p>Alternatively, you can choose not to use the grid and manually measure from <em>the cap height</em> (as shown in the gif below), but it would require zooming all the way in and out of the <em>pixel grid</em>. Plus, the size of the container that holds your text might not be a multiple of 4px.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Idy2n4hhAG5v4t5FxKZgOw.gif" /><figcaption>Above is an alternative workflow that measures directly from the cap height.</figcaption></figure><h3>Known issue — design-dev handoff</h3><p>Layout measured using the baseline grid approach would have seemingly random spacing numbers when developers use redlining tools (InVision/Zeplin/Figma) to inspect the design. The design below was created using the baseline grid. The numbers show what you would get from a redlining tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*p_dxocmqPQ5jzpfdDZDVhA@2x.png" /></figure><p>I briefly mentioned the <a href="https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62">Space in Design Systems</a> article above. It talks about how spacing values could be represented using CSS classes, which helps enforce consistency for both designers and developers. Unfortunately, by using the baseline grid approach, it is nearly impossible to represent the spacing numbers as a set of CSS classes because of the randomness that comes with the different combinations of types.</p><p>We also looked at a popular technique many people proposed to mitigate the randomness issue, which is to use ::before and ::after CSS pseudo-elements to “crop” the bounding box (which is essentially applying a correctional spacing to the line box). However, my code ninja boyfriend <a href="https://medium.com/@chriscaruso">Chris Caruso</a> told me:</p><blockquote>Using ::before and ::after CSS pseudo-elements is not ideal because it is not consistent across different fonts, browsers, operating systems, and even screen resolutions. Targeting a single combination may lead to spacing issues in others. From the developer’s perspective, the technique does not follow good coding practices because it uses negative margins and applies extraneous elements to the DOM — both of which can lead to unintended side effects. Therefore, in production applications this technique is not worth the risk. 😑</blockquote><h3>What about localization?</h3><p>I once did a localization study and looked at 8 writing scripts (Latin, Chinese, Cyrillic, Devanagari, Greek, Hangul, Kana and Thai) that our product supports. Then I realized that no matter which measuring approach you use, at the end of the day, it’s the bounding box spacing that the developer takes from the redlining tool and puts into CSS. Depending on the font you use for other non-English languages, even if the line height is the same, the visual height of the type can be taller or smaller than the latin letters. Their baselines can also shift. Therefore, no matter what measurement approach you use, localization will always change the spacing a little. However as shown in the example below, all languages’ text stayed relatively centered in the white space despite those minor changes.</p><p>(I still don’t know a lot about non-latin writing scripts, but want to learn more. Please let me know if any of the observations made above are not correct or can be improved. I only know English and Chinese. Shout out to my friends at work who helped me translate this line to the other languages!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*syBC3O5uazoOp4-QP_J0qg@2x.png" /><figcaption>Design created in English and localized to the other 7 writing scripts. Photo by <a href="https://unsplash.com/photos/71vAb1FXB6g?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Joshua Sortino</a> on <a href="https://unsplash.com/search/photos/san-francisco?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Questions?</h3><p>Please let me know if there’s anything that doesn’t make sense, or if you have any questions, feedback, or a better solution! I’ve been doing research on this topic for a long time now, so I would love to hear your thoughts! Please feel free to reach out to me directly through email (ethanw@microsoft.com) as well if you want to chat!</p><h3>Update — 8/18/2020</h3><p>Soon after I wrote this article, I came across an emerging CSS feature spec called leading-trim. Since then, I’ve been working with the spec author, an expert from the W3C CSS Working Group, the amazing <a href="https://twitter.com/fantasai">fantasai</a>, to make sure Microsoft Design can be a part of this transformative work. Today we published a new article announcing the partnership and talking about how this problem can be solved once for all. If you are interested in the solution, please check out the new article: <a href="https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202?source=friends_link&amp;sk=6e7bd88d2c1034f1a321c12e832feaf8">Leading-Trim: The Future of Digital Typesetting</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89485012dea6" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/the-4px-baseline-grid-89485012dea6">The 4px baseline grid — the present</a> was originally published in <a href="https://uxdesign.cc">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>