Search code examples
cssword-break

How to apply line break after space using CSS?


I am populating some data using JSON and that is dynamic data, So what I want is to break if there is a space in between the word, I have tried all the CSS but it is not working

I don't know what is going wrong.

I have tried these things

  • .name_class { white-space: normal; }
  • white-space: pre-line;

Working code


Solution

  • Here is one min-content will break word after space

    <div id="content" style="width: min-content;">aaaaaaaa bbbbbbbb</div>