2011-07-18 75 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! –