0

我有两个相邻的部分——一个是最近的工作,另一个是最近的博客文章。这些部分中的每一个都有 3 个缩略图,我希望在其最右侧有一个“下一步”按钮(尽管它将是一个椭圆的 .png)。在不影响其他元素的情况下,我很难将每个下一个按钮放到正确的位置。

这部分今天真的给我带来了一些麻烦,所以非常感谢任何和所有的帮助。

**如果我还要问:我一直无法在<p><span>下面为元素提供适当的填充(应该是 20 像素)。我如何实现这一目标?

这是我目前拥有的: 当前的

这是我希望最终设置的样子: 理想的

<div id="recent">
        <div id="recent-work">
            <p><span>Recent Work</span></p>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
            <div class="next">
                <a href="#"><img src="img/next.png" alt="Click for more information" /></a>
            </div><!-- end next -->
        </div><!-- end recent-work -->

        <div class="divider">
            <img src="img/divider.png" alt="Section divider" />
        </div><!-- end divider -->

        <div id="recent-blog">
            <p><span>Recent Blog</span></p>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
                <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
            <div class="next">
                <a href="#"><img src="img/next.png" alt="Click for more information" /></a>
            </div><!-- end next -->
        </div><!-- end recent-blog -->
    </div><!-- end recent -->

#recent {
    border-top: 1px solid #202020;
    padding-bottom: 40px;
    padding-top: 40px;
}

#recent .divider {
    display: block;
    float: left;
    margin-left: 20px;
}

#recent #recent-work {
    display: block;
    float: left;
}

#recent #recent-work p span {
    font-family: nevis-webfont;
    font-size: 112.5%;
    font-weight: normal;
    letter-spacing: 1px;
    padding-bottom: 20px;
    text-transform: uppercase;
}

#recent #recent-work a {
    padding-bottom: 40px;
    padding-right: 20px;
}

#recent #recent-work .next{
    float: right;
}

#recent #recent-blog {
    display: block;
    float: right;
}

#recent #recent-blog p span {
    font-family: nevis-webfont;
    font-size: 112.5%;
    font-weight: normal;
    letter-spacing: 1px;
    padding-left: 20px;
    text-transform: uppercase;
}

#recent #recent-blog a {
    padding-bottom: 40px;
    padding-left: 20px;
}

#recent #recent-blog .next{
    float: right;
}
4

1 回答 1

1

您可以尝试使用position: absolute;以获得您想要的“下一步按钮”。试试这个:

HTML

<div id="recent">
    <div id="recent-work">
        <p><span>Recent Work</span></p>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>

        <div class="next">
            <a href="#"><img src="img/next.png" alt="Click for more information" /></a>
        </div><!-- end next -->

     </div><!-- end recent-work -->

     <div class="divider">
        <img src="img/divider.png" alt="Section divider" />
     </div><!-- end divider -->

     <div id="recent-blog">
        <p><span>Recent Blog</span></p>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>
        <a href="#"><img src="http://lorempixel.com/130/130/" alt="Click for more information" /></a>

        <div class="next">
            <a href="#"><img src="img/next.png" alt="Click for more information" /></a>
        </div><!-- end next -->

     </div><!-- end recent-blog -->
</div><!-- end recent -->

CSS

#recent {
    border-top: 1px solid #202020;
    padding-bottom: 40px;
    padding-top: 40px;
}

#recent .divider {
    display: block;
    float: left;
    margin-left: 20px;
}

#recent #recent-work {
    display: block;
    float: left;
    position:relative;
}

#recent #recent-work p span {
    font-family: nevis-webfont;
    font-size: 112.5%;
    font-weight: normal;
    letter-spacing: 1px;
    padding-bottom: 20px;
    text-transform: uppercase;
}

#recent #recent-work a {
    padding-bottom: 40px;
    padding-right: 20px;
}

#recent #recent-blog {
    display: block;
    float: right;
    position:relative;
}

#recent #recent-blog p span {
    font-family: nevis-webfont;
    font-size: 112.5%;
    font-weight: normal;
    letter-spacing: 1px;
    padding-left: 20px;
    text-transform: uppercase;
}

#recent #recent-blog a {
    padding-bottom: 40px;
    padding-left: 20px;
}

#recent .next{
position:absolute;
bottom:-15px;
right:0;
}

希望它可以帮助你!

于 2012-06-18T17:36:48.393 回答