如何使按钮与文本垂直对齐?
我有这个 html:
<div id="details">
In the meantime,
<a href="http://www.twitter.com/iDreamStill" target="_blank"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-c.png" alt="Follow iDreamStill on Twitter"/></a>
or
<a href="http://twitter.com/share" class="twitter-share-button" data-text="DreamStill, a social music platform, is launching soon! Check it out!" data-count="none" data-via="iDreamStill" data-related="JustinMeltzer:Founder">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> us.
</div>
结果是这样的:
如何使文本和按钮全部垂直居中?
I have this html:
<div id="details">
In the meantime,
<a href="http://www.twitter.com/iDreamStill" target="_blank"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-c.png" alt="Follow iDreamStill on Twitter"/></a>
or
<a href="http://twitter.com/share" class="twitter-share-button" data-text="DreamStill, a social music platform, is launching soon! Check it out!" data-count="none" data-via="iDreamStill" data-related="JustinMeltzer:Founder">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> us.
</div>
The result is this:
How do I get the text and buttons all centered vertically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应用于每个图像的
vertical-align: middle
在大多数情况下应该可以解决问题。但是,如果按钮的一侧有阴影或不完全平衡,则可能无法获得像素完美的对齐效果。在这种情况下,请使用更多的蛮力:
vertical-align: middle
applied to each image should fix the problem in most cases.But if the buttons have shadows on one side or otherwise not exactly balanced, you might not get pixel-perfect alignment. In that case, use a little more brute force:
您是否尝试过
vertical-align
:更新
调整,因为徽章有一些特殊标记。查看实际操作 - http://jsfiddle.net/8zcZf/
Did you try
vertical-align
:UPDATE
Adjustments as the badges had some special markup. See it in action - http://jsfiddle.net/8zcZf/