The Importance of Manually Breaking Lines of Text
maxsavin.com
maxsavin.com
Also I'm not sure I want to take advice on how to lay out my content from someone who claims to be a designer but has his content in such a limited space (less than 40% of my screen space on a 15 inch monitor) and all the way to the left.
For the centering, margin: 0 auto; on .textWrapper is an improvement.
Have you A/B tested that?
1. Doesn't scale. You do not want to hand pick text all over your site/web-app. 2. It's not semantic. 3. It's very confusing to new people who looks at your code. 4. If you ever change a single char in that sentence, you will have to re-break it yourself.
<div class="desktop-breakline"></div>
with the appropriate @media query.
It's obviously not for every situation. But for landing and marketing pages, headlines, etc, I'd go as far as to say it's absolutely essential.
<span class="line">First line</span> <span class="line">Second line</span>
Make em block level in css, collapsing to display:inline at small sizes. (Can even set the size with a specific class, bootstrap-style).
For this example, you just need to know that the full sentence is likely to break some place on a large screen, and that the half-sentences are likely to fit without breaking on certain size screens.
Maybe you need the boundaries of likely maximum and minimum pixel widths, you certainly don't need to know the exact pixel width.
Css has font fall-backs for a reason, and if you ever use them, that means you don't know which font is actually being rendered. Which is not to mention platform differences for rendering even the same fonts.
And if any part of the text is variable, which is pretty much the basis for web apps, then you have another problem.
It would be pretty great if there was something like <wbr> that you could use for this scenario.
Sure, you don't want to override it for the entire web site, but if you're being specific enough about showing/hiding line breaks at certain breakpoints, then I don't see why you can't just specify with the class of the container (or whatever) which particular BR you want to hide in a given context.
<strong>Headline</strong><br> The quick brown fox jumped<hr> over the lazy dog.
And the code is clear and easy to read.
:D
One question for the author: Why repurpose a Horizontal Rule <hr> when HTML has a perfectly functional Line Break tag <br>?
You can use @media queries to set display: none; on <br> tags and then those <br> tags have no effect, and then you get to decide when they kick in.
This is a great idea, but ignoring the built-in line break to repurpose and restyle the horizontal rule tag seems like an arbitrary choice for implementing the technique.
For example:
<strong>Headline</strong><br>
The quick brown fox jumped <hr>
over the lazy dog.
You 100% want the line break after the headline, and want to set an optional one in the subtext.
I like it because its very clean to look at, but you can also create a responsive class like <div class="desktop-breakline"></div>
<strong>Headline</strong><br> The quick brown fox jumped <br class="soft"> over the lazy dog.
But now I'd rather just use the media query to only affect the <br> inside of the H1 or other container where the line break appears.
Another consideration I didn't see in the article that I train the people updating the marketing copy: put your white space before the line break. When it's all inline it will display as one line, but you don't want to have a space after the line break at the start of the new line. programmers may be conscientious of where the white space is but its a real eye-opener for marketing-types who only pay attention to the content, not the space around it!
They even wrote a jQuery plugin to implement the described behavior: https://github.com/adobe-webplatform/balance-text
> This page cannot be displayed because your computer is currently
> offline
"It looks pretty ugly - I hope you can understand why." """
But its not. When I see that, my eye is immediately drawn to the word that is on its own: offline. And what is the most salient piece of info in that error message? The fact that my computer is offline.