Things to consider for good typography on the web.
Tags: webdev, ux, uiweekly, design
Published: 2020-01-10 17:13:12

**Web Typography** refers to the text appears on your website. It's not only about the basic CSS text properties: What fonts to use, whether it should be **bold** or  *italic*  but also alignment, line height, spacing around: letters, words, and paragraph, etc.

Typography is about 90% of the design, it is a communication art.  When someone visits your website, they may not care much about the graphics but, surely they will read the content. Hence it is important to balance the graphics and text on the website. Most developers just ignore or never think about the typography - It is necessary to understand it's the psychological effect of conveying a message to an audience.  Before reading the text, people judge the seriousness of the text based on the typography (fonts). So let's get started, make sure you read this article till the end because you will find tools which can make this job easy.

# Importance of Typography

Let's first understand the importance of typography
### Keeps People Reading

![typo blog.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560092930944/2EpaLcrLW.png)
Good typography should allow the reader to focus on the content and not the formatting. Good typography often goes unnoticed because it just makes sense. Consider these two examples above. From above which article looks more legible and user-friendly? Which one would you prefer to read?

### Conveys a "feeling" or "seriousness" of text

Typography can affect how a piece of text is understood. Consider the example below, which one looks more suitable based on the title?

![font.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560671822927/VW1t0_YRn.png)
Most of us would choose the example on the top. The font size and type convey a feeling of power, seriousness, and importance; while the example on the bottom is fun.

# Things to consider for good web typography.

### 1. Too many fonts (**Bad Idea**)

Using too many fonts on a single webpage may not be a good idea because they all fight for their attention. It will distract the users and makes them focus on various fonts rather than the message conveyed and it also makes webpage load slowly. Check out the example line given below it's overwhelming.


![webty.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560674199029/2jeFx9QKZ.png)
Choosing the correct font will support the content. These are the places  on the web where you can find different fonts:

| Place         	| Price 	|     Quality |
|---------------	|-----	|------------:|
|[fonts.com](https://www.fonts.com)    	|  Paid 	|        Good |
| [fontspring](https://www.fontspring.com/)|  Paid 	|   Excellent |
| [Google fonts](https://fonts.google.com/)  	|  Free 	|        Good |
| [Font Squirrel](https://www.fontsquirrel.com/) 	| Free  	| Hit or Miss |

### 2. Text Alignment

Text alignment makes an impact on the way you read the text, you may never have noticed it before but your eyes may keep jumping from word to word instead of smooth motion. There are four types of alignment in typography:

* Left align
* Center align
* Justify
* Right align

Let's look at this one by one and understand when to use it.

**a) Left align**  
Left align is commonly used in all the text documents because this is how we read the text i.e. from left to right. It also gives a vertical anchor to the reader so that they can jump from line to line. The default `text-align` property of the web is always left but it can also be explicitly specified in the stylesheet.



![typo 3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560862813272/kCjEEiUnN.png)

The line on the left in the above image shows the anchor. In the long text, it is always preferable to use left alignment.

**b) Center align**  
Sometimes developers choose to use center alignment for some content on the webpage, it may not be a good idea if this property is used with the long texts. It doesn't provide an anchor on left like left alignment property, this makes it difficult for the readers to jump from line to line. As you see in the image below the anchor is present at the center which is a major flaw.

![typo 4.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560862959164/9o5s2wqcb.png)

Although there are problems, the center alignment will be a perfect fit for small texts: poems, small phrases, etc. 

**c) Justify**  
Justifying the text on the web is not suitable in the web typography because it generates uneven spaces between the words for aligning the text, which is not a good idea as the paragraphs look weird due to this and it even makes it difficult for the reader to jump between the words.

Especially when it comes to responsive web design it should be strictly avoided as the spacing between the words may look good on a device of particular size but they may get distorted on the small devices.

**d) Right align**  
Right alignment is rarely used in web development. there are few cases tough when it makes sense.

- While using language which is read from the right like Arabic.
- When there is some content already present on the right side of the content may be an image or an illustration. (works only when there is less amount of text content)
- It depends on your design, layout. Make sure that it complements your whole webpage.

### 3. Paragraph Separation

Paragraph separation is a fundamental function in the typography as paragraphs are used to introduce new sections of the story, characters or pieces of information. There are two ways to separate the paragraphs:
* Indents
* Margins between paragraphs

![typo blog1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560849193856/f12yZvOY2.png)

As shown in the image above you can easily understand which are two different paragraphs. **Never** use both ways to separate the paragraphs. The readers don't need two indications to understand the separation of paragraphs.

### 4. Line width

Like alignment, this may slightly affect the readability of the content.  It is always safe to include around 80-90 characters in a line. It takes energy for your eyes to move from the end of the line to the beginning of the next line. Longer lines also make it easy to get lost when you finish a line and need to jump to the beginning of the next line.

These are the reasons why so many websites use fixed-width layouts or split the content into multiple columns on wider screens. Without constraining the width of the page or dividing it into manageable columns, line length becomes unacceptably long.

### 5. Text Spacing (Vertical)

`line-height` CSS property will be used to define the vertical text spacing. This plays a major role in clean typography, it allows breathing between the lines which makes it easy for the reader to switch between lines and even read the line without focusing much on keeping track of the line they read.


![typo 5.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1560866113264/1xiNuhTIV.png)

In the image above: the paragraph on the right looks cluttered which makes it difficult to switch between the lines and reader even needs to keep track of the line which they are reading otherwise, they may switch to a different line unknowingly. 

# Typography tools

### 1. [archetype](https://archetypeapp.com/#)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ex59xz1qgdfhmc03w2mo.png)

Archetype lets you easily create consistent typography styling and spacing live, in the browser. Here are some amazing benefits of it

a) You can play with the fonts which will give you a clear idea of how your text is going to look on the web.

b) You can alter the spacing between words and paragraphs and instantly see the results on the right screen.

c) Mobile and Desktop preview of the text is available

d) As soon as you are fixed with your website's typography, you can export the CSS file which is one of the most useful features.

### 2.  [fontjoy](https://fontjoy.com/)  
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ac6z5bx91mrcuxqavzie.png)

This is another amazing tool that provides you with the facility of font pairing i.e. to select fonts that share an overarching theme yet have a pleasing contrast. You can use the generate button at the top to generate different combinations. It uses *neural nets* to generate these combinations of fonts. If you want to know how it all happens behind the scene you can visit this [link](https://fontjoy.com/pairing/)


### 3.  [Golden Ratio Typography Calculator](https://grtcalculator.com/)
 ![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wuwdrewwo4enox47rd8o.png)
 
This will help you discover the typography for your website by entering your current font, font size, and content width. This tool is similar to the first one but it suggests the styling based on fixed content width.

# Bonuses

### 1. [Calligraphr](https://www.calligraphr.com/en/) - Transform your hand writting into fonts

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/yizhnh1rnxnkbry3ncwj.png)
Creating your own font has never been easier. With your own font, you can create genuine personal designs and calligraphic artwork. This will make your website look different from others. Well, I suggest not use it if you don't have good handwriting 😅.

### 2. [kerntype](https://type.method.ac/)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ny618fxxbhl6ebwqeviq.png)
This will help you improve your sense of typography. You need to achieve pleasant and readable text by distributing the space between letters. Typographers call this activity kerning. Your solution will be compared to a typographer's solution, and you will be given a score.

Good luck with your next project!
I hope you enjoyed this article.
Happy Development.

>If my posts or resources I share has helped you in some way, please consider buying me a [coffee](buymeacoff.ee/puRIsFz). It will really help me pay my tuition fee and encourage me to share amazing and useful stuff with you all.