0

I'm using .scss files and compile them.
I have an element with the following css rule:

content: attr(data-tooltip) attr(data-tooltip);  

I'd like to add a line break in the content attribute using '\A' but it doesn't work.
When I use this rule:

content: attr(data-tooltip) '\A' attr(data-tooltip);

it prints the data with a single 'A' char instead of a line break.

When I use this rule:

content: attr(data-tooltip) '\\A' attr(data-tooltip);

it prints the content and a '\\A' instead of a line break.

When I change the content in the developer console to

content: attr(data-tooltip) '\A' attr(data-tooltip);

it prints a line break as wanted.

How can I make it add a line break using css?

EDIT: This element also has white-space: pre-wrap; rule.

EDIT: Seems like it's a know issue of css loader.

Sharon Haim Pour
  • 6,595
  • 12
  • 42
  • 64

1 Answers1

0

[data-tooltip]:after {
  content: attr(data-tooltip) '\A' attr(data-tooltip);
  white-space: pre-wrap;
}
<div data-tooltip="some tooltip text">The DIV</div>

Use

white-space: pre-wrap;

along with your \A.

connexo
  • 53,704
  • 14
  • 91
  • 128