2012-01-31 129 views
-3

我無法將我的帖子縮略圖對齊到左側。它是在CSS中聲明還是什麼?我用下面的代碼,但它不工作:wordpress縮略圖對齊

 <!--This section is currently pulling category ID #1, and can be switched by changing the cat=1 to show whatever category ID you would like in this area.--> 

     <div class="featured"> 
     <h2>Featured Category</h2> 

      <!--This is where the thumbnails are found for the homepage bottom section - note the custom field name for this image is "thumbnail". Recommended image size is 70x70, as the stylesheet is written for this size.--> 

      <?php $recent = new WP_Query("cat=1&showposts=3");  while($recent->have_posts()) : $recent->the_post();?> 
      <?php if(get_post_meta($post->ID, "thumbnail", true)): ?> 
       <a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="alt text" /></a> 
      <?php else: ?> 
       <a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php bloginfo('template_url'); ?>/images/thumbnail.jpg" alt="Default thumbnail" /></a> 
      <?php endif; ?>    
      <b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b> 
      <?php the_content_limit(80, ""); ?> 

      <div style="border-bottom:1px dotted #AFAFAF; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div> 

      <?php endwhile; ?> 

      <!--This is where you can specify the archive link for each section.--> 

      <b><a href="ENTER CATEGORY URL HERE" rel="bookmark">More Featured Category Posts</a></b> 

     </div> 

請研究代碼,給我的建議

+0

請不要發佈您的PHP代碼。我們需要看到HTML/CSS。 – 2012-01-31 19:42:22

+0

Html/css也在那裏。請閱讀代碼。 – uvishere 2012-01-31 20:04:59

回答

0

你可以給這個URL,所以我們可以看到什麼?內聯樣式很糟糕 - 相反,嘗試應用CSS類,然後定義邊距和浮點數。

我認爲有什麼東西會覆蓋float:left;