Design comparison
SolutionDesign
Solution retrospective
Using max-width
with ch
lets you limit the max width of a text element by character count, more specifically the width of the glyph "0" (zero) of the given font. This adapts to different font family and font sizes.
p {
max-width: 55ch;
}
More about ch unit.
More about length units from MDN website.
Community feedback
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord