2013-10-22 38 views
5

我在想如何将一组社交媒体按钮置于我的网站上。使用CSS定位HTML5中的按钮

我以前使用<center>标签,但切换到HTML5,所以我有我的其他文字和图像在CSS中心的属性。不过,我有4个不同的社交媒体网站,他们都使用不同的编码风格来实现按钮。 后续是我的代码


< - FB - > <div class="fb-like" data-href="https://www.facebook.com/pages/La-Condesa/242967619184322" data-width="20" data-height="20" data-colorscheme="light" data-layout="standard" data-action="like" data-show-faces="false" data-send="false"></div>

< - Instagram的 - > <style>.ig-b- { display: inline-block; } .ig-b- img { visibility: hidden; } .ig-b-:hover { background-position: 0 -60px; } .ig-b-:active { background-position: 0 -120px; } .ig-b-32 { width: 32px; height: 32px; background: url(//badges.instagram.com/static/images/ig-badge-sprite-32.png) no-repeat 0 0; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {.ig-b-32 { background-image: url(//badges.instagram.com/static/images/[email protected]); background-size: 60px 178px; } }</style><br><br>

<a href="http://instagram.com/lacondesafitzroy?ref=badge" class="ig-b- ig-b-32">img src="//badges.instagram.com/static/images/ig-badge-32.png" alt="Instagram" /></a>

< - 回应 - > <a href="https://twitter.com/LaaCondesa" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false">Follow @LaaCondesa</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

< - 的tumblr - ><iframe class="btn" frameborder="0" border="0" scrolling="no" allowtransparency="true" height="25" width="114" src="http://platform.tumblr.com/v1/follow_button.html?button_type=2&tumblelog=LaaCondesa&color_scheme=light"></iframe>


有定心所有HTML5这些项目的简洁的方式?或者我会不得不分别为每个人做?如果是这样的话,我怎么能把这些物品放在中间?

感谢

编辑:对不起,我离开了,它们都包含具有以下属性的容器内 .container { position: static;
height: 700px; width: 780px; top: 50%; left: 50%; margin: 10px;
margin-left: auto; margin-right: auto; }

退房www.lacondesa.com.au/test.html看到

回答

12

尝试把按键一个div里面的风格

text-align:center; 
margin:auto; 
+0

工作完美!非常感谢 – dweeman

+0

'margin:auto;'真的需要吗? – smartmouse

+1

'margin:auto'行中心div。 –

2

给一个DIV中特定的宽度,然后把margin:auto

div 
{ 
width://your width; 
margin:auto; 
} 
1

这可能工作。试试,

margin : 0px auto;