In this lesson, we'll cover how to use CH and VW units matched with tried-and-true CSS patterns to make a column of text that never exceeds legible line lengths while being fluid for responsive design.
Instructor: [0:00] We'll start with an element that contains multiple paragraphs of text. We want to limit that line length to make it as comfortable as possible for user to read.
[0:10] To do this, first, we'll set a width on our elements of 95vw, and set our left and right margins to auto. This will create a centered column of text with comfortable responsive margins.
[0:22] Next, we'll say max-width using the ch unit in CSS. The ch unit stands for a character unit and equals the width value of the zero character in the current font family. We use a max-width to allow the column to shrink and grow responsibly but never exceed that specific width value.
[0:43] Now usability guidelines, you'll want to set your column between 65 and 95 characters width. Your mileage may vary, so you want to play with these values to figure out the most comfortable line length for your font of choice.
[0:55] Maybe 65 characters is too narrow, but in Arial, which is the current font family, 95 ch is way too wide. In Arial, I find that 85 ch is a very comfortable usable line length.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!