[英]How can I indent all text in a paragraph except the first line?
This is an example fiddle .这是一个示例小提琴。
What I'm trying to do is indent everything after the first line.我想要做的是在第一行之后缩进所有内容。
Right now it looks like:现在它看起来像:
Categories: Aperiri
nostrum similique cu
pro, maiorum delectus
quo eu. Mentitum
I'm trying to get it to look like:我试图让它看起来像:
Categories: Aperiri
nostrum similique cu
pro, maiorum delectus
quo eu. Mentitum
I've tried adding to the css:我试过添加到 css:
display: block;
margin: 2px;
But this screws up my text wrapping.但这搞砸了我的文字换行。
How can I have inline display but also indent after the first line in css?如何在 css 中的第一行之后进行内联显示和缩进?
Use :first-line
and text-indent
tag.使用
:first-line
和text-indent
标签。 Put your whole text in one block (div or paragraph).将整个文本放在一个块(div 或段落)中。 Indent all lines and then set the first line to
text-indent = 0
缩进所有行,然后将第一行设置为
text-indent = 0
Example:例子:
p { text-indent: -10px }
p:first-line { text-indent: 0 }
How about this:这个怎么样:
.hClass p{
padding-left: 20px;
}
.iClass{
font-style: oblinque;
color: rgb(136, 136, 136);
font-family: Arial,Liberation Sans,DejaVu Sans,sans-serif;
margin-left: -20px;
}
See: http://jsfiddle.net/gVJK8/5/见: http : //jsfiddle.net/gVJK8/5/
I had the same problem.我有同样的问题。 The answers published here until now gave me a bad result (letters were overlapping each other) when complex layout (eg tables) was present in the paragraph being undented.
到目前为止,当段落中存在复杂的布局(例如表格)时,此处发布的答案给了我一个糟糕的结果(字母相互重叠)。
After much trying I found that the following didn't mess with these.经过多次尝试,我发现以下内容与这些无关。
text-indent: 0.5em hanging;
Only tried it in Chrome.只在 Chrome 中尝试过。
我发现最好使用这样的简单解决方案:
p:nth-child(n+2){text-indent: 3px;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.