调整google plus 1按钮的宽度

发布于 2024-12-05 17:23:40 字数 684 浏览 1 评论 0原文

我试图弄清楚如何修改 Google plus 1 按钮的宽度...

在文档中它说你可以设置宽度。

目前,当我使用 Firebug 检查元素时...它说宽度设置为 90px,我想设置为 70px...这可能吗?

    <!-- Place this tag where you want the +1 button to render -->
    <g:plusone size="medium"></g:plusone>

    <!-- Place this render call where appropriate -->
    <script type="text/javascript">
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>

I am trying to figure out how to modify the width of the Google plus 1 button...

In the documentation it says you can set a width.

Currently, when I examine the element using Firebug... it says the width is set to 90px, which I would like to set to 70px... is that possible?

    <!-- Place this tag where you want the +1 button to render -->
    <g:plusone size="medium"></g:plusone>

    <!-- Place this render call where appropriate -->
    <script type="text/javascript">
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(6

表情可笑 2024-12-12 17:23:40

如果您使用多个按钮,则 ID 并不总是相同,因此您可以使用这一 CSS 来捕获多个按钮:

[id^=___plusone] { width:72px !important; }

这适用于具有以 ___plusone 开头的 Id 的所有元素,这似乎是 Google 的按钮命名空间

The ID isn't always the same if you are using more than one button, so you can use this bit of CSS to catch multiple buttons:

[id^=___plusone] { width:72px !important; }

Which applies to all elements that have an Id that starts with ___plusone, which seems to be Google's namespace for the button

明月松间行 2024-12-12 17:23:40

不知道 iframe id 是否始终相同,但如果是,您可以使用 css + !important 来覆盖元素样式。比如:

/* this overrides 90px to 72px width to +1 button */
#___plusone_0{ width:72px !important; }

希望有帮助。

Don't know if the iframe id is always the same but if it is you can use css + !important to override the element style. Something like:

/* this overrides 90px to 72px width to +1 button */
#___plusone_0{ width:72px !important; }

Hope it helps.

萝莉病 2024-12-12 17:23:40

您可以在代码生成器中选择几个高度设置,但您也可以不要选择任意大小值。

You can pick from a couple of height settings at the code generator, but you can't pick an arbitrary size value.

旧时浪漫 2024-12-12 17:23:40

我对按钮的大小不一样感到沮丧,所以我通过 css + javascript 来让 32x32 +1 按钮正常工作。您可以在此处获取详细信息:

http://bashireghbali.com/technology/google -plus-one-button-32x32/

请注意,在页面重新加载时,它不会显示 +1ed 状态(目前还没有回调,除非有人知道尚未宣布的回调)

I was frustrated by the buttons not all being the same size as well so I managed through css + javascript to get a 32x32 +1 button working. You can get the details here:

http://bashireghbali.com/technology/google-plus-one-button-32x32/

note that on page reload it will not show +1ed state (no callback for that yet unless someone knows of a yet unannounced one)

孤云独去闲 2024-12-12 17:23:40

我发现如果你不是想改变物理按钮的宽度,而只是想把宽度变小来调整定位。

最好的方法是设置:

#id_of_button {
位置:相对;
左:(效果最好的)px
希望

有帮助。

I found that if you're not trying to change the width of the physical button, but just trying to make the width smaller to adjust positioning.

The best way is to set:

#id_of_button {
position: relative;
left: (whatever works best)px
}

Hope that helps.

高速公鹿 2024-12-12 17:23:40

这里的答案已经过时了,所以我想写下关于右对齐谷歌加一个按钮的内容的可能性的注释。

因此,如果像我一样,您尝试将宽度强制为任意大小以向右对齐,请忘记它并使用 align="right" 代替!

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

更多信息请参见:https://developers.google.com/+/web/+1button/

The answer here are getting old so I wanted to drop a note on the possibility to align right the content of the google plus one button.

So if like me you are trying to force width to whatever size to align on right forget it and use align="right" instead!

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

More info here: https://developers.google.com/+/web/+1button/

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