2011-03-25 61 views
0

嘿,我想在我的标题标签(h2)旁边添加一个likebox并将其保留在同一行上。因此,它看起来像:This is the Title LikeBox如何将Facebook Likebox与标题标签放在同一行上?

但正在发生的事情是likebox即将开始一个新行是这样的:

This is the Title 
LikeBox 

是否有任何人愿意帮助我吗?如果它是可能的?

我的CSS是:

.post-details h2 { 
border-bottom: 1px solid #E1E1E1; 
font-size: 16px; 
margin: 0 0 0 0; 
padding: 0 0 5px 0; 
font-weight: bold; 
} 

和HTML代码是:

<h2><?php the_title(); ?><h2> 
<div id="fb-root"></div> 
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo get_permalink(); ?>" layout="button_count" show_faces="true" width="50" rel="nofollow"></fb:like> 

感谢您的时间。

回答

0

@jonny h1,h2,h3,<p>他们都自动进行100%的宽度。所以,你必须给你的浮标h2标签

.post-details h2 { 
float:left; 
border-bottom: 1px solid #E1E1E1; 
font-size: 16px; 
margin: 0 0 0 0; 
padding: 0 0 5px 0; 
font-weight: bold; 
} 
#fb-root { 
    float:right; 
} 
0

使用这个代替:

<div id="fb-root"> 
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo get_permalink(); ?>" layout="button_count" show_faces="true" width="50" rel="nofollow"></fb:like> 
</div> 
<h2><?php the_title(); ?></h2> 

然后在你的CSS,添加:

#fb-root { 
    float: right; 
} 
相关问题