Summary
Line length is important in both the user experience (UX) and the developer experience (DX). The best range suggested for readability is between 45-75 characters. The Web Accessibility Initiative (WAI) sets the line length standard for AAA to no more than 80 characters in length. A physiological reason for this is due to the eye movement called saccade, or the rapid movements our eyes make to perceive what is around us. It is easier for reading if the eyes can see the start of the next line while leading the line above it. I may have gone down a rabbit hole as well learning that it is a reason ancient texts went from scroll-based to codex-based! Too many characters can result in users having a negative experience, but so can too little characters in a line of text. Too short of lines require the eyes to jump around too much and can make it more difficult to read a line of text. Some text might not be read, which can lead to negative experiences and significant problems.
Readability and line length is also impacted by line height, and while there is never a perfect “feel” for perfect readability by all, there is a “comfortable” line length per line height for most human beings, and that has been found between 45-75 characters, keeping in mind that shorter lines need less height, and longer lines need more height. Otherwise, text can be too stressful to read because it is either too compact, or too loose and broken. The type of text type of device (desktop versus mobile) may also impact the line length and line height used. Focusing on the accessibility standards can provide content that is more readable to everyone.
With the actual creation of the code, it is important that any code written is also readable and easy to work with, no matter who is writing or editing the code. One part of helping the code be readable is by paying attention to the line length of each line of code as well. From my research, the longest-lasting standard of code line length was 80 characters. This 80-character standard originated back when IBM punch cards were 80 characters, which progressed to 80-character computer terminals. While modern devices and monitors can show way more characters, it is still a good idea to limit to around 80 characters for the physiological reasons of how human brains read.
Solution
CSS can provide solutions to line length of a block of text within a website by setting the CSS property, max-width, with font-relative lengths around 70ch or 34rem, depending on the font style used. Other font-relative lengths may be used for different user interface (UI) components like buttons or navigation for readability to be optimized.