A rare use case for em units

text-decoration-offset is a good use case for em units. Most of the time we favor rems over ems, but in this case we want the text underline offset to proportionally scale with the `font-size` property. Here’s a quick demo: See […]


This content originally appeared on Brad Frost and was authored by Brad Frost

text-decoration-offset is a good use case for em units. Most of the time we favor rems over ems, but in this case we want the text underline offset to proportionally scale with the `font-size` property. Here’s a quick demo:

See the Pen Text decoration offset by Brad Frost (@bradfrost) on CodePen.

This little nugget came from some fun in-the-weeds typography design token chats with a big publisher client today. They were looking at setting up text-decoration-offset-specific tokens. Part of me tells me this is overkill, but the other part understands that links and underlines is very much a core part of their business.

We proposed trying to avoid text-decoration-offset tokens if they could help it in order to reduce the number of tokens they have to manage. There are already plenty of tokens to manage, and this particular organization has 40 themes to support, so the fewer moving parts the better. So hopefully the humble em can help make their system a bit more maintainable.


This content originally appeared on Brad Frost and was authored by Brad Frost


Print Share Comment Cite Upload Translate Updates
APA

Brad Frost | Sciencx (2024-06-04T19:52:23+00:00) A rare use case for em units. Retrieved from https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/

MLA
" » A rare use case for em units." Brad Frost | Sciencx - Tuesday June 4, 2024, https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/
HARVARD
Brad Frost | Sciencx Tuesday June 4, 2024 » A rare use case for em units., viewed ,<https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/>
VANCOUVER
Brad Frost | Sciencx - » A rare use case for em units. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/
CHICAGO
" » A rare use case for em units." Brad Frost | Sciencx - Accessed . https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/
IEEE
" » A rare use case for em units." Brad Frost | Sciencx [Online]. Available: https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/. [Accessed: ]
rf:citation
» A rare use case for em units | Brad Frost | Sciencx | https://www.scien.cx/2024/06/04/a-rare-use-case-for-em-units/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.