【问题标题】:adjusting width of google plus 1 button调整谷歌加1按钮的宽度
【发布时间】:2011-09-22 14:39:28
【问题描述】:

我正在研究如何修改 Google 加 1 按钮的宽度...

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

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

    <!-- 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>

【问题讨论】:

    标签: google-plus-one


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

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

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

      希望对您有所帮助。

      【讨论】:

      • 为我工作!只需将 #___plusone_0{ width:72px !important; } 放入您的 CSS 中
      【解决方案3】:

      您可以从code generator 的几个高度设置中进行选择,但不能选择任意大小值。

      【讨论】:

        【解决方案4】:

        我对按钮大小不一而感到沮丧,因此我通过 css + javascript 进行管理以使 32x32 +1 按钮正常工作。您可以在此处获取详细信息:

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

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

        【讨论】:

          【解决方案5】:

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

          最好的方法是设置:

          #id_of_button { 位置:相对; 左:(最好的)px }

          希望对您有所帮助。

          【讨论】:

            【解决方案6】:

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

            因此,如果您像我一样尝试将宽度强制为任何大小以在右侧对齐,请忘记它并改用align="right"

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

            更多信息在这里:https://developers.google.com/+/web/+1button/

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2014-01-23
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多