【问题标题】:wordpress thumbnail alignmentwordpress 缩略图对齐
【发布时间】:2012-02-23 12:54:21
【问题描述】:

我的帖子缩略图无法左对齐。是在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>

请研究代码并给我建议

【问题讨论】:

  • 请不要发布您的 PHP 代码。我们需要查看 HTML/CSS。
  • Html/css 也在那里。请阅读代码。

标签: php css wordpress-theming wordpress


【解决方案1】:

您能否提供此网址以便我们查看?内联样式不好 - 相反,请尝试应用 CSS 类,然后定义边距和浮动。

我假设某些东西正在覆盖 float:left;

【讨论】:

    猜你喜欢
    • 2011-09-25
    • 2023-04-02
    • 2015-10-25
    • 1970-01-01
    • 2011-12-31
    • 1970-01-01
    • 2017-03-19
    • 2012-07-20
    相关资源
    最近更新 更多