[英]CSS indent paragraph after an inserted div?
My goal: Have all paragraphs indent except for the ones following .firstCharacter. 我的目标:让所有段落都缩进,.firstCharacter之后的段落除外。
I have a drop cap leading off the first paragraph of certain sections in my page. 我在页面某些部分的第一段有一个首字下沉。 I have set all the paragraph tags after the first one to indent using... 我将第一个标记后的所有段落标记设置为缩进使用...
.storyContainer p + p {
text-indent: 1.5em;
margin-top: 0
}
I am setting my drop cap using... 我正在使用...设置空投上限
.firstcharacter {
float: left;
font-size: 80px;
line-height: 60px;
padding-top: 4px;
padding-right: 8px;
padding-left: 3px;
font-family: 'Droid Serif', serif;
}
My html is as such... 我的html就是这样...
<div class="headline">This is a headline!</div>
<p><span class="firstcharacter">T</span>his text NOT indented because it's first</p>
<p>This text will be indented because it's second.</p>
<p>This text will be indented because it's third.</p>
<div class="someBox">This is some extra box</div>
<p>I want this to be indented but it won't be because it is first after the box!</p>
<p>This text will be indented because it's second.</p>
<div class="headline">This is a headline!</div>
<p><span class="firstcharacter">T</span>his text NOT indented because it's first</p>
<p>This text will be indented because it's second.</p>
<p>This text will be indented because it's third.</p>
<div class="someBox">This is some extra box</div>
<p>I want this to be indented but it won't be because it is first after the box!</p>
<p>This text will be indented because it's second.</p>
Any help on how to get this squared away? 对如何解决这个问题有帮助吗?
Thanks! 谢谢!
http://jsfiddle.net/WRKxQ/ http://jsfiddle.net/WRKxQ/
html: 的HTML:
<div class="headline">This is a headline!</div>
<p class="firstcharacter"><span>T</span>his text NOT indented because it's first</p>
<p>This text will be indented because it's second.</p>
<p>This text will be indented because it's third.</p>
<div class="someBox">This is some extra box</div>
<p>I want this to be indented but it won't be because it is first after the box!</p>
<p>This text will be indented because it's first.</p>
<div class="headline">This is a headline!</div>
<p class="firstcharacter"><span>T</span>his text NOT indented because it's first</p>
<p>This text will be indented because it's second.</p>
<p>This text will be indented because it's third.</p>
<div class="someBox">This is some extra box</div>
<p>I want this to be indented but it won't be because it is first after the box!</p>
<p>This text will be indented because it's first.</p>
css: CSS:
p {
text-indent: 1.5em;
margin-top: 0
}
.firstcharacter {
text-indent: 0;
}
.firstcharacter span {
float: left;
font-size: 80px;
line-height: 60px;
padding-top: 4px;
padding-right: 8px;
padding-left: 3px;
font-family:'Droid Serif', serif;
}
this should solve it? 这应该解决吗?
i basically just shifted your css and html a bit. 我基本上只是将您的css和html移了一点。
have fun 玩得开心
jascha 茉莉花
For your first line, you can just use p::first-line{}
to indent it. 对于第一行,您可以使用p::first-line{}
进行缩进。 For your first character, you can use p::first-letter
.For IE<9 you will want to use only one colon. 对于第一个字符,可以使用p::first-letter
。对于IE <9,您将只想使用一个冒号。
To select all the paragraphs after the first one, you can use the nth-child(n) pseudo-class. 要选择第一个之后的所有段落,可以使用nth-child(n)伪类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.