gpt4 book ai didi

internet-explorer - 在

之后对具有特定类的元素应用填充

转载 作者:行者123 更新时间:2023-11-28 09:27:52 24 4
gpt4 key购买 nike

我想做的是在 header1 <p> 之后的最后一个元素(例如段落 <ul> 或无序列表 <h1>)具有名为 specialInstructionsNotes 的类的元素仅将额外的填充 (30px) 应用到类 specialInstructionsNotes 的 last 元素。

我尝试合并使用 :first-of-type:nth-of-type(1) CSS3 选择器,但这些选择器不会转移到 IE8(这是我要使用的最低 IE 兼容浏览器)。我的目标是能够在所有最新的浏览器和 IE8+ 中显示 CSS 设置(即 类为 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>

如果我需要进一步解释,请告诉我。

最佳答案

像这样的解决方法呢?

.specialInstructionsNotes {
padding-bottom: 30px; /* set padding for all special elements */
}
.specialInstructionsNotes + .specialInstructionsNotes {
margin-top: -30px; /* but make the next element hide the bottom padding
of its preceding siblings of the same class */
}

关于internet-explorer - 在 <h1> 之后对具有特定类的元素应用填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17622821/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com