如何使用html在标题后插入长空格?

时间:2013-01-22 08:30:34

标签: html html5

我正在使用带标题标签的html。

例如:

<html>
  <head>
    <title> Title Name  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;                                                                      </title>
  </head>
</html>

在这里我想要使用html代码在“标题名称”之后的长空格。 我试图使用&nbsp;,但它太长了,无法放置代码。标题之后的任何其他空间替代。

4 个答案:

答案 0 :(得分:1)

如果您的问题是您只是想避免编写和大部分&nbsp;代码。如果你使用PHP,我建议你这样做:

<title>Start <?php str_repeat("&nbsp;", 30); ?> End</title>

否则,我发现像你一样使用&nbsp;很多没问题。

答案 1 :(得分:1)

我不明白为什么长度会成为问题,但您可以使用实际的NO-BREAK SPACE U + 00A0字符而不是实体引用&nbsp;,例如

<title>Title Name                                                        </title>

答案 2 :(得分:1)

关于FeRtoll的答案,既然你不想使用PHP,你可以使用JavaScript库将一些PHP函数移植到JS。

http://phpjs.org/functions/str_repeat/

答案 3 :(得分:1)

&nbsp;&thinsp;&ensp;&emsp;呢?