0

I have an element

<div class="Test_then">The result is ...</div>

The Test_then class looks like this:

.Test_then::before {
  content: 'Then';
}

My goal is to have the (The result is ...) appear below the Then content added by the Test_then class. So in other words in would render like this:

Then
The result is ...
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

1

If your generated content simply consists of the word "Then" inline, you can just add a newline with \a, and use white-space: pre-wrap (or pre) to cause the newline to render as an actual line break:

.Test_then::before {
  content: 'Then\a';
  white-space: pre-wrap;
}

An example of this is also provided in the spec.

If your generated content needs to be displayed as a block for any reason, then it becomes even simpler — display: block alone will have the same effect:

.Test_then::before {
  content: 'Then';
  display: block;
}
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356