2012-01-31 65 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;