如何在html中的文本之间放置空格? [英] How to put spaces between text in html?

查看:302
本文介绍了如何在html中的文本之间放置空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在html文本之间放置空格?例如,

<p>a b       c</p>

在b和c之间留出什么空间?

解决方案

尝试使用 white-space ,其值为pre.

pre保留空白序列.行仅在源代码和<br>元素中的换行符处断开.

 p {
  white-space: pre;
} 

 <p>a b       c</p> 

如果您需要每个黑色空格正好占据一个字符宽度,请使用等距字体. /p>

 p {
  white-space: pre;
  font-family: monospace;
} 

 <p>a b       c</p> 

How do you to put spaces between text in html? For example,

<p>a b       c</p>

What do you put to have space between b and c?

解决方案

Try using white-space with value pre.

pre Sequences of whitespace are preserved. Lines are only broken at newline characters in the source and at <br> elements.

p {
  white-space: pre;
}

<p>a b       c</p>

Use a monospaced font if you need each black space to take exactly one character width.

p {
  white-space: pre;
  font-family: monospace;
}

<p>a b       c</p>

这篇关于如何在html中的文本之间放置空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆