是否可以在HTML中插入一个制表符,而不必键入 四次吗?


当前回答

我只想建议:

/* In your CSS code: */
pre
{
    display:inline;
}

<!-- And then, in your HTML code: -->

<pre>    This text comes after four spaces.</pre>
<span> Continue the line with other element without braking </span>

其他回答

这是一个很难看的解决方法,但是你可以这样做

var tab = '&nbsp;&nbsp;&nbsp;&nbsp;';

然后在字符串中使用tab变量。

只有“pre”标签:

<pre>Name:      Waleed Hasees
Age:        33y
Address:    Palestine / Jein</pre>

你可以在这个标签上应用任何CSS类。

CSS

<html>
<head>
<style>
    tab:before
    {
        content: "\00a0\00a0\00a0\00a0";
    }
</style>
</head>

HTML

<body>
    <tab> #include &lt; stdio.h &gt; <br>
    <tab> <br>
    <tab> int main (void) <br>
    <tab> { <br>
    <tab> <tab> printf ("Hello, World!"); <br>
    <tab> <tab> return 0; <br>
    <tab> } <br>
</body>
</html>

呈现

最好使用pre标签。pre标记定义预格式化文本。

<pre>
 This is
preformatted text.
It preserves      both spaces

and line breaks.

</pre>

了解更多关于前标签在这个链接

如果您只需要一个选项卡,那么下面的选项卡对我有用。

<style>
  .tab {
    position: absolute;
    left: 10em;
   }
</style>

使用HTML的内容如下:

<p><b>asdf</b> <span class="tab">99967</span></p>
<p><b>hjkl</b> <span class="tab">88868</span></p> 

你可以添加更多的“标签”通过添加额外的“标签”样式和改变HTML,如:

<style>
  .tab {
    position: absolute;
    left: 10em;
   }
  .tab1 {
    position: absolute;
    left: 20em;
   }
</style>

使用HTML的内容如下:

<p><b>asdf</b> <span class="tab">99967</span><span class="tab1">hear</span></p>
<p><b>hjkl</b> <span class="tab">88868</span><span class="tab1">here</span></p>