简体   繁体   English

Node.js 博客 - 添加帖子时,所有内容都在一行中

[英]Node.js blog - when add post, everything is in one line

I have a problem, I'm making a simple blog with node.js and when user add a post, no matter how many enters or spaces he press, everything is in one line.我有一个问题,我正在用 node.js 制作一个简单的博客,当用户添加帖子时,无论他按下多少个输入或空格,所有内容都在一行中。

I would like to have it nice, if I press 5 spaces- have 5 spaces.如果我按 5 个空格 - 有 5 个空格,我希望它很好。 I thought also about posibility to let user use html tags like etc.我还考虑过让用户使用 html 标签等的可能性。

Could you give me some advices how can I do that?你能给我一些建议我该怎么做?

https://github.com/Lok3rs/Karolina-Cieplicka-Fotografia https://github.com/Lok3rs/Karolina-Cieplicka-Fotografia

That's all the code I have right now.这就是我现在拥有的所有代码。

Thank you!谢谢!

Without a minimum reproducable example, it's time consuming for anyone to give accurate advice.如果没有最低限度的可重复示例,任何人提供准确的建议都非常耗时。 So my wild guess is you're using div's or the like to render the text, which by default will compress whitepsace.所以我的猜测是你使用 div 或类似的东西来渲染文本,默认情况下会压缩 whitepsace。

 .preserve-whitespace { white-space: pre; }
 <div> leading, trialing, and internal white space are compacted in divs </div> <pre> leading, trialing, and internal white space are **NOT** compacted in pres </pre> <div class="preserve-whitespace"> this can be controlled with the 'white-space' style </pre>

Look into the white-space , overflow-wrap , and word-break css properties for more customization.查看white-spaceoverflow-wrapword-break css 属性以获得更多自定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM