Html 制表间距
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1352442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
tabulation spacing
提问by Ayoub M.
is there an equivalent to the consoles special char '\t' in html ?
是否有与 html 中的控制台特殊字符 '\t' 等效的字符?
采纳答案by strager
Use tables for table data.
将表格用于表格数据。
There is no standard way to tabulate data without a table (either a real table using <table> or faking it with CSS display
).
没有表格(使用 <table> 的真实表格或使用 CSS 伪造表格)没有标准的方法来制表数据display
。
回答by oeai
i'm using " " looks better than " "
我正在使用“ ” 看起来比“ ”好
回答by Roman Bekkiev
Inside the <pre>tags you can use 	 which is the unicode symbol of tabulation. But outside preformated section browser will show it as a space.
在<pre>标签内,您可以使用 这是制表的Unicode符号。但外部预格式化部分浏览器会将其显示为空格。
回答by Sampson
You could use CSS's text-indent
rule to apply a pre-defined indentation to the first line of a textblock.
您可以使用 CSS 的text-indent
规则将预定义的缩进应用于文本块的第一行。
<p style="text-indent:20px;">Hello World. I'm indented 20px.</p>
回答by meder omuraliev
Other than relying on non breaking spaces, you can use a literal tab character inside of pre element, or by specifying white-space:pre as such:
除了依赖不间断空格之外,您还可以在 pre 元素内使用文字制表符,或者通过指定 white-space:pre 如下:
<p id="foo">tab between</p>
<style>
p#foo {
white-space:pre;
}
回答by Owen
Not that I know of, I usually use or pre elements.
我不知道,我通常使用 或预元素。
回答by AugustoM
I needed to tabulate a simple listing in html and used CSS to 'fake it', here is the code:
我需要在 html 中列出一个简单的列表并使用 CSS 来“伪造”,这是代码:
/*CSS classes*/
.text-tabs-1{float:left;}
.text-tabs-2{
float:left;
margin-left:190px;
display:block;
position:absolute;
}
.clearer{clear:both;}
<!--HTML-->
<p>
<span class="text-tabs-1"><strong>Some text</strong>:</span><span class="text-tabs-2">Some indented text.</span><br />
<span class="text-tabs-1"><strong>Some text</strong>:</span><span class="text-tabs-2">Some indented text.</span><br />
<span class="text-tabs-1"><strong>Some text</strong>:</span><span class="text-tabs-2">Some indented text.</span><br />
<span class="text-tabs-1"><strong>Some text</strong>:</span><span class="text-tabs-2">Some indented text.</span><br />
</p>
<div class="clearer"></div>
回答by samivic
<p style="margin-left:2em"></p>
<p style="margin-left:2em"></p>
回答by Roshan Yadav
You can use this code  
to add a space in the html. For tab space use it 5 times or more.Check here: https://www.w3schools.com/charsets/tryit.asp?deci=8287&ent=ThickSpace
您可以使用此代码 
在 html 中添加一个空格。对于制表符空间,请使用 5 次或更多。在这里查看:https://www.w3schools.com/charsets/tryit.asp?deci=8287&ent=ThickSpace
回答by Pedro Emilio Borrego Rached
if what you need is different levels of tabulation use list, and set the style: "list-style-type:none" www.w3schools.com/html/html_lists.asp
如果您需要的是不同级别的制表使用列表,并设置样式:“list-style-type:none” www.w3schools.com/html/html_lists.asp