wordpress缩略图对齐

时间:2012-01-31 19:35:38

标签: php css wordpress-theming wordpress

我无法将我的帖子缩略图左对齐。它是在CSS中声明还是什么?我使用了以下代码,但它不起作用:

        <!--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>

请研究代码并给我建议

1 个答案:

答案 0 :(得分:0)

你能给出这个网址,以便我们看到吗?内联样式很糟糕 - 相反,尝试应用CSS类,然后定义边距和浮动。

我假设某些事情正在覆盖浮动:左;