On main element div cant update before element white-space value?


How can make on red background to make the text wrap to next line with ::before?

Thank you.

Don’t understand question or what are you trying to do. An example of content ::before is the bullet or number in front of a li. All webpage content, let’s call it prose, has to be inside html elements, for example: the div in your jsfiddle. When the prose gets too long it wraps to the next line. background-color:red; will give a red background to any html element. content ::before is not for prose or to make a line wrap. If this is not helpful will you please explain further.

Thank you for help! Well i think understand but not really. I want to make on ::before that content inside text to make wrap to next line because max-width property.

wrap is not a valid value for the white-space property. white-space: normal; will let if wrap and if you want the break between characters you can also add word-break: break-all;

1 Like