谷歌+按钮删除右侧的可用空间/边距|向右对齐
有什么方法可以将谷歌加号按钮向右对齐吗?看来 g+ 按钮可以保留一些位置,以防出现更多数字。如果 sulution 可以只使用 css/html - 不使用 javascript,那就太好了。
更新
看来google从昨天开始对1+按钮的api进行了一些更改,但似乎仍然无法将其向右对齐。
更新2
问题已于 2011 年 8 月 24 日提出。从那时起,Google+ 已经发生了多次变化。不再需要向这篇文章发送垃圾邮件答案(重复,并且答案相同!)。你们所建议的选项当时并不存在。查看 google+ 文档网页上的参数:https://developers .google.com/+/plugins/+1button/?hl=pl#plusonetag-parameters
Is there any way to align google plus button to right? It seems that g+ button holds some place in case there were more digits. It would be nice if sulution could be using only css/html - no javascript.
update
It apears that google has changed a little bit api of 1+ button since yesterday, but still it seems impossible to align it to the right.
update 2
Question has been asked on Aug 24 '11. Since then Google+ has changed several times. There's no need to spam answers to this post anymore (repeated, and same answers!). Options you all suggest didn't existed at the time. Check out parameters on google+ documentation webpage: https://developers.google.com/+/plugins/+1button/?hl=pl#plusonetag-parameters
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
现在,您只需将
data-align="right"
添加到中即可。例如:
这将使
的内容保持右对齐。
Nowadays you just add
data-align="right"
to your<div>
. For example:That will keep the contents of the
<iframe>
aligned to the right.如果您想将 +1 按钮向右对齐,则应该使用“高”外形尺寸(因为它会向上展开),或者将 +1 按钮配置为不显示计数。其中任何一个都会消除右侧数字的松弛空间。可以在此处找到解释如何执行此操作的文档:http://code.google .com/apis/+1button/#button-sizes
现在,右侧的填充已消失,您可以使用 CSS 来对齐按钮。
If you would like to align the +1 button right, you should either use the 'tall' form factor, since it expands up, or configure the +1 button to not display the count. Either of these will remove the slack space for numbers on the right side. The documentation explaining how to do this can be found here: http://code.google.com/apis/+1button/#button-sizes
Now that the padding is gone on the right side you can use CSS to align the button.
将以下属性添加到 g:plusone 标记:
从以下位置获取解决方案
https://developers.google.com/+/plugins/+1button/ #按钮大小
Add the following attribute to the g:plusone tag:
Got the solution from
https://developers.google.com/+/plugins/+1button/#button-sizes
将 +1 按钮标记的
align
属性设置为right
。Set the
align
attribute toright
for the +1 button tag.我发现的最简单的解决方案是将加一个按钮 div 包装在一个容器中,为该容器提供一个类和样式,以便根据需要浮动。
The easiest solution I have found is to just wrap the plus one button div in a container, give the container a class and style that to float how ever you require.
昨天遇到了这个确切的问题。将命名空间加一标签包装在 div 中并向右浮动。
你总是可以使用样式表来覆盖谷歌发送的内联样式,
因此对于这样的标记:
你可以使用这个CSS:
然后宽度将适应它需要的宽度,并且优先于谷歌的内联样式
JS Fiddle
encountered this exact problem yesterday. wrapped the namedspaced plus one tag in a div and floated right.
you could always use a stylesheet to override the inline styles that google send down the wire
so for markup like this:
you could have this CSS:
the width will then adapt to be as wide as it needs to be, and will take precedence over google's inline style
JS Fiddle
我会尝试将按钮放入
div
中。然后我会让这个div
小于按钮,以切除按钮的右侧部分。您需要调整 css 中的position
和overflow
选项。I would try to put the button into a
div
. Then I would make thisdiv
smaller than the button to cut away the right part of the button. You need to adjust theposition
andoverflow
options in your css.