Published: 11/30/2017
This is a simple tip on how to wrap newlines without converting newlines to <br>
tags. This is quite handy if you have a text without formatting and the only need is to wrap text paragraphs. You don't have to think about HTML sanitization or conversion.
.wrapped-text {
white-space: pre-line;
}
This trims newlines from the start and end of the text. Value pre-line
doesn't render whitespaces in the middle of the text.
Be the first commenter?
I am an experienced web developer with an eye for solid UI/UX design. I have specialized in front-end development, responsive web design, design systems, modern web frameworks, and content management systems. I also have experience in mobile apps development and back-end coding with PHP, Node.js, and Java. So I have a full stackish background, but I'm enjoying most building robust and beautiful front-ends with performance, accessibility, and testability in mind.
© Tero Auralinna
Auralinna.fiSunset with Bubbles: Travel and Photography Blog