将文本拉近div

时间:2011-07-18 13:06:41

标签: css

我在wordpress中编写了一个循环,循环播放帖子标题,然后在页面顶部的特殊最新新闻栏目中显示前6个。问题是,我无法将标题更接近,如图所示[2]。我希望这些标题显示如图所示[1]          [1]:http://i.stack.imgur.com/igNOe.png          [2]:http://i.stack.imgur.com/92DW7.png

继承我的HTML和PHP代码:

<div id="freshlyWrapper">
<div id="freshlyposts">
<?php
$freshlyIonised = new WP_Query();
$freshlyIonised->query('category_name=featured&showposts=6');
while($freshlyIonised->have_posts()):
$freshlyIonised->the_post();
?>
<div class="freshlyionisedbox"><h3><?php the_title(); ?></h3></div>
<?php endwhile; ?>

继承人css

#freshlyWrapper {
width: 980px;
text-align: left;
background: #ffffff;
float:left;
}

#freshlyposts {
width:980px;
margin: 0 auto;
text-align: left;
height: 100px;
color: #000000;
}

.freshlyionisedbox {
position: relative;
float:left;
height: 25px;
margin-left: 140px;
padding:0px;
top: 3px;
}

#freshlyposts h3 {
width:auto;
font-weight: normal;
letter-spacing: normal;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:13px;
}

.clearboth { clear:both; } 

1 个答案:

答案 0 :(得分:3)

.freshlyionisedbox {
position: relative;
float:left;
height: 25px;
margin-left: 40px; /*-- try it --*/
padding:0px;
top: 3px;
}