converting white space into line break

后端 未结 2 465
無奈伤痛
無奈伤痛 2021-01-18 02:19

Is it possible to add a line break on each white space using CSS?

For example, if I have string \"Format It\" I would like to display it like

         


        
2条回答
  •  [愿得一人]
    2021-01-18 03:25

    A solution would be to make it not wide enough, the standard white-space handling will make the lines wrap :

    p {
      width:1px;
    }
    

    demonstration

    But it really depends on your use case and specific needs.

提交回复
热议问题