【问题标题】:make an image appear aligned (or floating) to the right使图像向右对齐(或浮动)
【发布时间】:2012-02-19 17:36:32
【问题描述】:

我安装了允许显示作者照片的 Wordpress 用户照片插件。到目前为止一切顺利,但我希望它不是在发布日期之后显示,而是与作者的姓名和发布日期平行。 下图说明了一切:

看来我设法创建了一个新的 CSS 类。我在 css 中添加了:

featured-posts-block .user-photo {}

然后在循环中,我将用户照片代码包裹在同一个 CSS 东西中,所以现在是:

为了测试它,我添加了“border:2px solid blue;”到 CSS 上,结果很好..

但我无法让它浮动到文本的右侧,就像我在上面的照片中展示的那样。感谢您的帮助。

如果我想在显示图像时调整图像大小,请告诉我代码是什么样子的。

可以看到的网站: http://kuttabna.net

我用来显示该块的代码:

<h2 class="entry-title"></a><a>" rel="bookmark" title="<?php printf(__('رابط  %s', 'framework'), get_the_title()); ?>"> <?php the_title(); ?></a></h2>

<!--BEGIN .entry-meta .entry-header-->
                        <div class="entry-meta entry-header">
                    <span class="published"> كتبها
                    <?php the_author_posts_link(); ?>  </span>
                    <span class="meta-sep">·</span>
                    <span class="published"> في <?php the_time( get_option('date_format') ); ?>
<?php userphoto_the_author_thumbnail() ?></span>
                            <!--END .entry-meta entry-header -->
                        </div>

【问题讨论】:

    标签: css image alignment wordpress


    【解决方案1】:

    图像被打印在一个带有 user-photo 类的 div 中,使用 float: right 为该类添加一个新样式到你的页面。包括 margin-left 5px 只是为了一些间距。

    <style type="text/css">
    div.user-photo{
        float: right;
        margin-left: 5px;
    }
    </style>
    

    【讨论】:

    • 太好了,非常感谢布赖恩!你能告诉我如何强制不同的图像尺寸吗?我的意思是当它在那里显示时调整它的大小?编辑:好吧,我成为了 CSS 专家,哈哈,我在类的末尾添加了 img(在我复制它之后)并添加了 width + height 属性。再次感谢你:)
    猜你喜欢
    • 2013-05-05
    • 1970-01-01
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 2012-07-05
    • 1970-01-01
    • 2020-03-17
    • 1970-01-01
    相关资源
    最近更新 更多