【发布时间】:2015-02-13 09:16:16
【问题描述】:
您好,我正在尝试将我的 h2 标题放在它们所在的 div 的顶部,但我不知道如何删除填充/边距/导致它们被隔开的任何东西至今。
这是我第一次尝试使用“部分”,我正在使用它们来创建视差滚动网站。我已经上传了这个网站,所以你可以看到它的实际效果。在它声明“标题一”、“标题二”等的地方,这就是我想要在它们所在的 div 顶部提出的内容。
示例网站网址...http://www.littleroomproductions.com/jQtest/
以下是我认为需要更改的代码部分,以便将标题带到 div 的顶部...
//HTML
<section class="box content">
<div id="me"></div>
<div class="container">
<h2>Title One</h2>
<p>This is where text goes </p>
<div class="someContent">
<p>click me</p>
</div>
</div>
</section>
//使用的CSS
section.box:last-child {
margin-bottom: 0;
}
section.box h2 {
padding-top: 0;
margin-bottom: 20px;
color: #606060;
font-family: serif;
font-size: 30px;
}
section.box p {
padding-top: 0;
margin-bottom: 20px;
color: black;
font-size: 20px;
font-family: cursive;
font-weight: 300;
}
section.box p:last-child {
margin-bottom: 300px;
}
section.box.content {
padding-top: 0;
padding-left: 40px;
padding-bottom: 40px;
}
section.box.slide {
padding: 240px 0;
background-position: 0 0;
}
section.box.slide h1 {
color: yellow;
font-size: 48px;
/*line-height: 1;*/
font-weight: 700;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 10px black;
}
【问题讨论】:
-
您的演示链接已损坏。
-
修复了示例的链接