是否可以在HTML中插入一个制表符,而不必键入 四次吗?
当前回答
理想的CSS代码应该是“display”和“min-width”属性的组合…
display: inline-block;
min-width: 10em; // ...for example, depending on the uniform width to be achieved for the items [in a list], which is a common scenario where tab is often needed.
其他回答
你还可以使用:
p::before {
content: "";
padding-left: 30px;
}
然后用你想到的其他选择器替换p。
CSS
<html>
<head>
<style>
tab:before
{
content: "\00a0\00a0\00a0\00a0";
}
</style>
</head>
HTML
<body>
<tab> #include < stdio.h > <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>
呈现
我只想建议:
/* 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/HTML方法考虑em和rem度量单位。
CSS
.tab { margin-left: 1rem; }
HTML
<div class=“tab> ...p and h elements... </div>
显示
1em约等于4 但是,Em unit和&nbsp rem unit的显示取决于元素和样式的使用,像这样缩进。
--------h1 indented 1em
--p indented 1em
----h1 indented 1rem
----p indented 1rem
左边距和左填充都有效。在HTML或CSS中没有标签长度单位。可以使用.tab类选择器。
只有“pre”标签:
<pre>Name: Waleed Hasees
Age: 33y
Address: Palestine / Jein</pre>
你可以在这个标签上应用任何CSS类。
推荐文章
- 使伸缩项目正确浮动
- 形式内联内的形式水平在twitter bootstrap?
- 自定义元素在HTML5中有效吗?
- 如何触发自动填充在谷歌Chrome?
- 创建圈div比使用图像更容易的方法?
- 为什么Chrome浏览器不正确地确定页面是在不同的语言,并提供翻译?
- 在网页上用鼠标模拟震颤(例如帕金森病)?
- Bootstrap抛出Uncaught错误:Bootstrap的JavaScript需要jQuery
- 如何改变文本区域的边框颜色:焦点
- 我如何设置背景颜色为文本的宽度,而不是整个元素的宽度,使用CSS?
- 如何删除和清除所有的本地存储数据
- 强制打开“另存为…”弹出打开文本链接点击PDF在HTML
- 如何修改标签文本?
- 在HTML中还有其他有用的空格码吗,比如半空格的 , em-spaces, en-spaces等等?
- 输入触发器按钮单击