谷歌+按钮删除右侧的可用空间/边距|向右对齐

发布于 2024-11-30 22:29:37 字数 512 浏览 2 评论 0原文

有什么方法可以将谷歌加号按钮向右对齐吗?看来 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

救赎№ 2024-12-07 22:29:37

现在,您只需将 data-align="right" 添加到

中即可。例如:

<div class="g-plusone" data-align="right" data-size="medium" data-href="http://www.mywebsite.com"></div>

这将使 的内容保持右对齐。

Nowadays you just add data-align="right" to your <div>. For example:

<div class="g-plusone" data-align="right" data-size="medium" data-href="http://www.mywebsite.com"></div>

That will keep the contents of the <iframe> aligned to the right.

爱给你人给你 2024-12-07 22:29:37

如果您想将 +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.

臻嫒无言 2024-12-07 22:29:37

将以下属性添加到 g:plusone 标记:

align="right"

从以下位置获取解决方案
https://developers.google.com/+/plugins/+1button/ #按钮大小

Add the following attribute to the g:plusone tag:

align="right"

Got the solution from
https://developers.google.com/+/plugins/+1button/#button-sizes

划一舟意中人 2024-12-07 22:29:37

将 +1 按钮标记的 align 属性设置为 right

<g:plusone align="right"></g:plusone>

Set the align attribute to right for the +1 button tag.

<g:plusone align="right"></g:plusone>
朱染 2024-12-07 22:29:37

我发现的最简单的解决方案是将加一个按钮 div 包装在一个容器中,为该容器提供一个类和样式,以便根据需要浮动。

<!-- Google +1 button -->
<div class="plusonealign"><div class="g-plusone" data-size="medium"  data-align="left"></div></div>

.plusonealign {
    float: left;
}

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.

<!-- Google +1 button -->
<div class="plusonealign"><div class="g-plusone" data-size="medium"  data-align="left"></div></div>

.plusonealign {
    float: left;
}
动次打次papapa 2024-12-07 22:29:37

昨天遇到了这个确切的问题。将命名空间加一标签包装在 div 中并向右浮动。

你总是可以使用样式表来覆盖谷歌发送的内联样式,

因此对于这样的标记:

<div class="myPlusOneWrapper">
    <div id="theActualPlusOneWrapper" style="whatever google send down the wire">
        <!-- blah -->
    </div>
</div>

你可以使用这个CSS:

.myPlusOneWrapper
{
     float: right;
}

.myPlusOneWrapper > div
{
    width: auto !important;
}

然后宽度将适应它需要的宽度,并且优先于谷歌的内联样式

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:

<div class="myPlusOneWrapper">
    <div id="theActualPlusOneWrapper" style="whatever google send down the wire">
        <!-- blah -->
    </div>
</div>

you could have this CSS:

.myPlusOneWrapper
{
     float: right;
}

.myPlusOneWrapper > div
{
    width: auto !important;
}

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

一抹微笑 2024-12-07 22:29:37

我会尝试将按钮放入 div 中。然后我会让这个 div 小于按钮,以切除按钮的右侧部分。您需要调整 css 中的 positionoverflow 选项。

I would try to put the button into a div. Then I would make this div smaller than the button to cut away the right part of the button. You need to adjust the position and overflow options in your css.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文