UI/UX šŸ’© / Tips

Six tips for better web typography

Six tips for better web typography

UI/UX šŸ’©Ā /Ā TipsĀ Ā·Ā March 7, 2019 at 3:54pm
six_tips_for_better_web_typography.png
How do we avoid the most common mistakes when it comes to setting type on the web? Thatā€™s the question thatā€™s been stuck in my head lately as Iā€™ve noticed a lot of typography thatā€™s lackluster, frustrating, and difficult to read. So, how can we improve interfaces so that our content is easy to read at all times and contexts? How do learn from everyone elseā€™s mistakes, too?

#Rule #1: Set a good max-width for paragraphs

This is typically referred to as the measure in typographic circles and highly esteemed typographers will recommend that a paragraph have a width of around 75 characters for legibility reasons. Anything longer than that becomes difficult to read and causes unnecessary strain on the eyes because of the distance the eye has to travel left-to-right and back again (assuming ltr that is).

Hereā€™s a quick example of a good max-width setting for a paragraph. Oh, and make sure to check out this demo on larger screen devices.

https://codepen.io/robinrendle/pen/jdQXwd

Now, this all depends on a ton of factors that great designers contemplate when setting a paragraph. However, as web designers, the difficulty for us is that we have to make sure that paragraphs feel good in additional contexts, like on mobile devices, too. So, while this rule of ~75 characters is nice to have in our back pocket, it's most helpful when weā€™re trying to figure out the maximum width of our text block. More on this in a bit.

Also, Iā€™d recommend setting that width on a container or grid class that wraps the paragraph instead of setting a max-width value on the paragraph element itself.

Kind of like this:

html

<div class="container">
<p>This is where our text goes.</p>
</div>
css
p {
font-size: 18px;
line-height: 24px;
}
.container {
max-width: 600px;
}

Otherwise, there may be moments in the future when there's a need for certain paragraphs to be bigger and have a wider measure (like for introductory paragraphs perhaps). In those situations, making a different container class that just handles the larger width of the elements inside them is a nice and modular approach.

Iā€™ve found that by having a system of classes that just deals with the width of things encourages writing much less code but also much more legible code as well. Although, yes, there is more HTML to write but Iā€™d say thatā€™s preferable to a lot of whacky CSS that has to be refactored in the future.

In short: make sure to set a good max-width for our paragraphs but also ensure that we set the widths on a parent class to keep our code readable.

Read full article on https://css-tricks.com/six-tips-for-better-web-typography/

Load previous messages

April 11, 2019 at 9:28pm

Great article šŸ‘‹

    like-fill
    1
    • reply
    • like

    April 12, 2019 at 11:02pm