我想要做的是在 header1 元素之后的最后一个元素(例如段落<p>
或无序列表),该元素具有一个类,该类被称为仅对具有类 specialInstructionsNotes的最后一个元素应用额外的填充(30px) 。<ul>
<h1>
specialInstructionsNotes
我尝试合并使用:first-of-type
和:nth-of-type(1)
CSS3 选择器,但这些选择器并没有转移到 IE8(这是我要使用的最低 IE 兼容浏览器)。我的目标是能够在所有最新的浏览器和 IE8+ 中显示CSS 设置(即仅将填充应用于带有 class 的最后一个元素)。specialInstructionsNotes
注意:可以有 3 个或更多元素应用了这个类,只要这个类的最后一个元素.specialInstructionNotes
在最底部有填充。很抱歉有任何混淆。
这是我到目前为止的完整 CSS:
.specialInstructionsNotes {
color: #004abc;
font-size: 1.1em;
line-height: 26px;
padding: 0 3%;
}
h1 + p.specialInstructionsNotes + *,
h1 + ul.specialInstructionsNotes + *,
h1 + p.specialInstructionsNotes:nth-of-type(1),
h1 + ul.specialInstructionsNotes:nth-of-type(1) {
padding: 0 0 30px;
}
h1 + p.specialInstructionsNotes:first-of-type,
h1 + ul.specialInstructionsNotes:first-of-type {
padding: 0;
}
对于 HTML,元素位于一个 div 中,并且是 div 中包含的最顶层元素。这是我目前遇到的一些页面/场景的 HTML。
第 1 页:
<div class="span12 main">
<h1><small>Proposal Narrative</small></h1>
<p class="specialInstructionsNotes">A narrative proposal sufficient for peer review is required. Narratives can be up to <strong>5 single-spaced (12 pt. font) pages</strong>. Please note: the bibliography does <em>not</em> count towards the 5-page limit). The narrative should include:</p>
<ul class="specialInstructionsNotes">
<li>A statement of the objectives and significance of the proposed research/creative activity.</li>
<li>A summary of relevant previous work by the applicant and/or others in the field.</li>
<li>A description of the plan for accomplishing the objectives - include methodology, the roles of all personnel involved, and plans for access to any special resources.</li>
<li>Although budget details and justification for personnel and non-personnel costs are required in the budget section, the narrative should make reference to all items, activities, and services of the requested funding.</li>
</ul>
.
.
.
other elements added to the page
.
.
.
</div>
第2页:
<div class="span12 main">
<h1><small>Brief Summary of Current Research/Creative Activities</small></h1>
<p class="specialInstructionsNotes">A brief summary of the investigator’s research/creative activities, whether or not they are related to the activities proposed in this application.</p>
.
.
.
other elements added to the page
.
.
.
</div>
第 3 页:
<div class="span12 main">
<h1><small>Supplemental Information</small></h1>
<ul class="specialInstructionsNotes">
<li>Supplemental information is not required. </li>
<li>Please do not upload article reprints or book chapters. </li>
<li>Uploaded files must be less than 1 megabyte in size. If you are attempting to upload scanned documents please use the OCR function to convert them to text before uploading. </li>
</ul>
.
.
.
other elements added to the page
.
.
.
</div>
第 4 页:
<div class="span12 main">
<h1><small>Publication List</small></h1>
<ul class="specialInstructionsNotes">
<li>A listing of publications and/or performances/creative activities for the last three years of the investigator(s)</li>
<li>Vitae are not requested</li>
</ul>
<p class="specialInstructionsNotes">Each applicant on the proposal should upload a separate list. This list will be stored in the system and you may retrieve it in the future. If you or any other CoPI had previously uploaded a publication list, it will be shown below.<br /><br />
<strong>Please upload your own publication list only.</strong>
</p>
.
.
.
other elements added to the page
.
.
.
</div>
如果我需要进一步解释,请告诉我。