W3School TIY
编辑您的代码:
<html> <head> <style type="text/css"> p {white-space: pre-wrap;} </style> </head> <body> <p>This paragraph has a great many s p a c e s with its textual content, but their preservation will not prevent line wrapping or line breaking.</p> <p>注释:当 white-space 属性设置为 pre-wrap 时,浏览器不仅会保留空白符并保留换行符,还允许自动换行。</p> </body> </html>
查看结果: