Right align Facebook like button

 ̄綄美尐妖づ 提交于 2019-12-30 01:42:05

问题


I am able to put a Facebook like button on my website, but how do I make it to be right-aligned within the div/iframe it is in?

I tried applying various CSS properties, but I could not get anything to move in the iframe.


回答1:


iframe is an inline element, you can use

text-align: right

for a div that contains that iframe, or float the iframe to the right, but just make sure to clear the float afterwards.

sample: http://jsfiddle.net/Mujj6/3/
and: http://jsfiddle.net/Mujj6/5/




回答2:


I think this link could help too: http://shades-of-orange.com/post/2011/01/09/Embed-Facebook-Like-Button-e28093-Right-Align-with-css-and-Settings.aspx

It says to set the width to "0". Then the box will be autoresize by Facebook and you can apply a float right to that box.




回答3:


Seems as though there are many ways to achieve this that work in different situations.

None of the above seemed to make any difference to the position of my 'like' button, however a little trial and error with a "margin-left" tag and I got it in the right place.




回答4:


Thanks for everyone's input. The position relative trick doesn't always do it for me:

div.around-fb-like{
    position:relative;
    float:right;
}

So far this has been more dependable:

#fb-root{
    position:absolute;
    left:-1000%;
}



回答5:


What is described in Embed Facebook Like button – Right align with CSS and settings works. However, in my website, I had to change the style to

position:relative; right:-130px;



回答6:


the 'like' social plug-in seems to have changed styles within the iframe. what's the best way to prevent the 'like' from flowing right, on the following page?

[http://www.biographile.com/the-righteousness-and-ruin-of-science-on-this-week-in-history/16573/][1]




回答7:


With DIV it's easy:

.fb-like{ vertical-align:top;}

posted also on SimpleMediaCode.info ( http://e-art.lv/x/fbas )



来源:https://stackoverflow.com/questions/4118475/right-align-facebook-like-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!