是否可以在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>

其他回答

阿菲克,唯一的办法就是使用

&nbsp;

如果你可以使用CSS,那么你可以使用填充或边距。参看Box模型,而对于ie浏览器,也可参阅ie浏览器的Box模型bug。

使用CSS更简洁。试试padding-left:5em或margin-left:5em。

我使用一个不带项目符号的列表来呈现“标签”外观。 (这是我在使用MS Word时有时会做的事情)

在CSS文件中:

.tab {
    margin-top: 0px;
    margin-bottom: 0px;
    list-style-type: none;
}

并且在HTML文件中使用无序列表:

This is normal text
<ul class="tab">
    <li>This is indented text</li>
</ul>

这个解决方案的美妙之处在于,您可以使用嵌套列表进一步缩进。

一个新手在这里说话,所以如果有任何错误,请评论。

您可以使用一个表并将width属性应用于第一个<td>。

<table>
    <tr>
        <td width="100">Content1</td>
        <td>Content2</td>
    </tr>
    <tr>
        <td>Content3</td>
        <td>Content4</td>
    </tr>
</table>

结果

Content1       Content2
Content3       Content4

好吧,如果你只需要在一整段的某一行开头有一个很长的空白,那么这可能是一个解决方案:

<span style='display:inline-block;height:1em;width:4em;'>&nbsp;</span>

如果写的内容太多,或者在很多地方都需要这样的制表符,那么您可以这样做

<span class='tab'>&nbsp;</span>

然后将其包含到CSS中:

span.tab {display:inline-block;height:1em;width:4em;}