Friday, 13 November 2015

Post: 34: How to add a linebreak with CSS

Apart from inserting a line break (or carriage returns) with </br> in your HTML, you can insert a linebreak with CSS too, since CSS is responsible for layout and flow - a line break can be considered either of those.

.linebreakWithCSS {
  display: block;
  white-space: pre;
  content: "Line 1 \ALine 2\A...";
}

The CSS snippet above will print you the following:
Line 1
Line 2
...

No comments:

Post a Comment

Tweet