2011-07-18 106 views
0

我已经在wordpress中编写了一个循环,它循环显示帖子标题,然后在页面顶部的特殊最新新闻栏目中显示前6个。问题是我无法使标题更接近图像[2]。我想所示的图像,这些标题出现在[1] [1]:http://i.stack.imgur.com/igNOe.png [2]:http://i.stack.imgur.com/92DW7.png使文字更靠近div

我的继承人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; } 

回答

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

@hackre:谢谢,只是重新编辑我的答案,但你更快;) –

+0

@hakre:尽量不要在发布后立即编辑答案。回答者通常会在5分钟的宽限期内对其进行编辑。 – thirtydot

+0

我一直在试图解决这个问题2个小时,这很简单。谢谢Arthur Halma! –