[英]CSS alternatives to first line text-indent?
I am having a problem with how the <p>
text-indent property is rendered when a page is printed with Internet Explorer's Active-X plugin. 我在使用Internet Explorer的Active-X插件打印页面时如何呈现<p>
text-indent属性时遇到问题。 Here is the relevant CSS: 这是相关的CSS:
p {
font-family: Calibri;
font-size: 20pt;
line-height: 1.75em;
margin-bottom: 1.00em;
margin-top: 1.00em;
margin-left:1.0em;
margin-right:1.0em;
text-indent:1.5em;
}
Below you can see what is happening when the HTML page, using the above code, is printed: 下面您可以看到使用上面的代码打印HTML页面时发生的情况:
The top of every new page has the text indentation applied! 每个新页面的顶部都应用了文本缩进! Is there an alternative method of having the first line of every <p>
"paragraph tag" indented without using "text-indent" property? 是否有另一种方法让每个<p>
“段落标记”的第一行缩进而不使用“text-indent”属性? The solution must be browser independent. 解决方案必须独立于浏览器。
What about using ::first-letter
pseudo-element? 那么使用::first-letter
伪元素呢?
p:first-letter {
padding-left: 30px;
}
Browser Support 浏览器支持
Chrome Safari Firefox Opera IE Android iOS
1+ 1+ 1+ 3.5+ 5.5+ All All
You could use pseudo elements
to mimic the effect of text-indent 您可以使用pseudo elements
来模仿text-indent的效果
p:before
{
content: '\00A0 \00A0 \00A0 \00A0 \00A0 \00A0 \00A0';
dispay:inline-block;
}
EDIT: (As per the questioner's comments below) 编辑:(根据提问者的评论如下)
If the above CSS solution(s) don't work for you, then maybe instead of using css 如果上面的CSS解决方案不适合你,那么可能不是使用css
you could just append a fixed number of non-breaking spaces after each paragraph element. 你可以在每个段落元素之后附加固定数量的不间断空格。
Like so <p> ...
像这样<p> ...
<p> ...
You could do this simply by copy/replace: 你可以简单地通过复制/替换来做到这一点:
<p> -> <p> ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.