新闻发布链接的CSS间距

时间:2013-08-15 17:16:27

标签: css web news-feed

我只是想把这些新闻发布好,所以每篇文章之间都有差距。我在下面附上了一张图片来解释。我尝试增加以下填充,但这不起作用。谢谢你的帮助

.headline {
position: absolute;
padding-top: 15px;
}

http://www.petrowestcorp.com/home/

enter image description here

3 个答案:

答案 0 :(得分:0)

您好,您可以在css中执行此操作。

.feedburnerFeedBlock > ul > li {
    padding-top: 15px;
}

span元素不是block元素,如果您将范围设置为例如,则只能应用维度display: block

答案 1 :(得分:0)

JSfiddle应该适合您。

<强> HTML

<div class='feedburnerFeedBlock'>
    <ul>
        <li>
             <h6>August 13, 2013</h6>

            <p><a href='#'>Petrowest Corporation Announces Second Quarter 2013 Financial Results and New Contract Award for Civil Division</a>
            </p>
        </li>
        <li>
             <h6>May 13, 2013</h6>

            <p><a href='#'>Petrowest Corporation Announces First Quarter 2013 Financial Results</a>
            </p>
        </li>
    </ul>
</div>

<强> CSS

a {
    color: #000;
    text-decoration: none;
}
h6, p {
    font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.5;
}
h6, p, .feedburnerFeedBlock ul, .feedburnerFeedBlock ul li {
    margin: 0;
    padding: 0;
}
h6 {
    color: #777;
}
.feedburnerFeedBlock ul {
    list-style-type: none;
    margin: 10px 0;
    width: 320px;
}
.feedburnerFeedBlock ul li {
    margin-bottom: 15px;
}

答案 2 :(得分:0)

您的新闻稿如下所示:

.feedburnerFeedBlock ul li {
  list-style-type: none;
  text-align: left;
  font-size: 12px;
  line-height: 1.5em;
  overflow: auto;
  padding-top: 10px;
}

这是我用上面的css代码看起来的样子:

enter image description here

正如答案中其他地方所建议的那样,除非您明确将其display属性设置为类似于块/内联块级元素,否则不能给出padding-top / bottom。因此,我们不是在span上设置该属性,而是将其设置为li标记。但是,我添加了overflow:auto,因为您的css没有包含其元素,因为您已将position:absolute设置为跨度。这也可以设置正确的位置。