CSS中的图像对齐问题& PHP

时间:2012-11-02 15:23:00

标签: css wordpress

我对CSS& s的过程非常陌生。 PHP,但使用Wordpress&小部件我试图用我的插件变得更好。

我正试图让我的小twitter鸟出现在我的Twitter内容消息旁边,但它仍然是消息的顶部。

我想要实现的一个例子可以在这里找到。 http://globe-trekking.com/twitter_ideal.jpg(无法添加图片,因为这是我的第一篇文章)

我怎么能过来这个。

我的相关PHP代码是:

$widgetContent .= "<span class='entry-content'><img class='twitter_bird' src='http://globe-trekking.com/running/wp-content/themes/newscast/images/bird_blue_16.png'>{$entryContent}</span>";

完整的PHP代码是:

    $widgetContent .= '<ul>';
    if ( ! is_array( $tweets ) || count( $tweets ) == 0 ) {
        $widgetContent .= '<li class="wpTwitterWidgetEmpty">' . __( 'No Tweets Available', $this->_slug ) . '</li>';
    } else {
        $count = 0;
        foreach ( $tweets as $tweet ) {
            // Set our "ago" string which converts the date to "# ___(s) ago"
            $tweet->ago = $this->_timeSince( strtotime( $tweet->created_at ), $args['showts'], $args['dateFormat'] );
            //$entryContent .= '<li>';
            $entryContent = apply_filters( 'widget_twitter_content', $tweet->text, $tweet );
            $widgetContent .= "<span class='entry-content'><img class='twitter_bird' src='http://globe-trekking.com/running/wp-content/themes/newscast/images/bird_blue_16.png'>{$entryContent}</span>";
            $widgetContent .= " <span class='entry-meta'>";
            $widgetContent .= "<span class='time-meta'>";
            $linkAttrs = array(
                'href'  => "http://twitter.com/{$tweet->user->screen_name}/statuses/{$tweet->id_str}"
            );
            $widgetContent .= $this->_buildLink( $tweet->ago, $linkAttrs );
            $widgetContent .= '</span>';

            if ( 'true' != $args['hidefrom'] ) {
                $from = sprintf( __( 'from %s', $this->_slug ), str_replace( '&', '&amp;', $tweet->source ) );
                $widgetContent .= " <span class='from-meta'>{$from}</span>";
            }
            if ( !empty( $tweet->in_reply_to_screen_name ) ) {
                $rtLinkText = sprintf( __( 'in reply to %s', $this->_slug ), $tweet->in_reply_to_screen_name );
                $widgetContent .=  ' <span class="in-reply-to-meta">';
                $linkAttrs = array(
                    'href'  => "http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id_str}",
                    'class' => 'reply-to'
                );
                $widgetContent .= $this->_buildLink( $rtLinkText, $linkAttrs );
                $widgetContent .= '</span>';
            }
            $widgetContent .= '</span>';

            if ( 'true' == $args['showintents'] ) {
                $widgetContent .= ' <span class="intent-meta">';
                $lang = $this->_getTwitterLang();
                if ( !empty( $lang ) )
                    $linkAttrs['data-lang'] = $lang;

                $linkText = __( 'Reply', $this->_slug );
                $linkAttrs['href'] = "http://twitter.com/intent/tweet?in_reply_to={$tweet->id_str}";
                $linkAttrs['class'] = 'in-reply-to';
                $linkAttrs['title'] = $linkText;
                $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );

                $linkText = __( 'Retweet', $this->_slug );
                $linkAttrs['href'] = "http://twitter.com/intent/retweet?tweet_id={$tweet->id_str}";
                $linkAttrs['class'] = 'retweet';
                $linkAttrs['title'] = $linkText;
                $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );

                $linkText = __( 'Favorite', $this->_slug );
                $linkAttrs['href'] = "http://twitter.com/intent/favorite?tweet_id={$tweet->id_str}";
                $linkAttrs['class'] = 'favorite';
                $linkAttrs['title'] = $linkText;
                $widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
                $widgetContent .= '</span>';
            }
            //$widgetContent .= '</li>';

            if ( ++$count >= $args['items'] )
                break;
        }
    }

    $widgetContent .= '</ul>';

我的CSS代码是:

.widget_twitter div {
padding:0;
width:280px;
}

.widget_twitter ul li {
margin-bottom:5px;
margin-left:0px;
clear:both;
}

.widget_twitter a {
text-decoration:none;
color:#333333;
margin: 0 10px 10px 0;
}
.widget_twitter a:visited {
text-decoration:underline;
color:#FF00FF;
}
.widget_twitter a:hover {
text-decoration:underline;
color:#0000CC;
}

.widget_twitter .follow-button,
.widget_twitter .xavisys-link {
margin:0 10px 10px 25px;
}
.widget_twitter .entry-content {
width:260px;
display: inline-block;
line-height:22px;
margin-top:10px; 
margin-left: 13px;

}

.widget_twitter .entry-content twitter_bird {
vertical-align:middle;
}
.widget_twitter .entry-meta {
display:block;
font-size:80%;
margin-bottom: 10px;
margin-left: 13px;
}

.widget_twitter .intent-meta a {
background-image: url('images/everything-spritev2.png'); /** from Twitter resources */
display: inline-block;
text-indent: -9999px;
margin: 0 10px 10px 0;
height: 16px;
width: 16px;
}
.widget_twitter .in-reply-to-meta {
margin: 0 10px 10px 0;
}
.widget_twitter .intent-meta a.in-reply-to {
 background-position: 0 center;
}
.widget_twitter .intent-meta a:hover.in-reply-to {
background-position: -16px center;
}
.widget_twitter .intent-meta a.favorite {
background-position: -32px center;
}
.widget_twitter .intent-meta a:hover.favorite {
background-position: -48px center;
}
.widget_twitter .intent-meta a.retweet {
background-position: -80px center;
}
.widget_twitter .intent-meta a:hover.retweet {
background-position: -96px center;
}

非常感谢任何帮助。我已经设法让它变得“体面”,但除此之外,这是我尝试了很多事情的最后一步。

此致 丹尼尔

1 个答案:

答案 0 :(得分:0)

很抱歉快速回答,可能是我错了,但尝试使用 float:left 作为鸟类图片。