谷歌加一代码作为内联块
我得到的谷歌加一代码如下。这很好地显示了按钮。
<div class="g-plusone" data-href="http://www.example.com"></div>
<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>
当我在此代码后面放置一些 HTML 时,+1 代码会创建新行,并且以下元素将出现在网络行中。我尝试将“div
”更改为“span
”,我尝试将“style="display: inline”
”添加到“div
”标签。但它们都不起作用。
我如何更改此代码片段,以便以下元素不会换行?
谢谢。
I get Google plus one code as follows. This shows button well.
<div class="g-plusone" data-href="http://www.example.com"></div>
<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>
When i put some HTML after this code, +1 code creates new line, and following elements apeear in net line. I tried to change "div
" with "span
", i tried to add "style="display: inline"
" to "div
" tag. But none of them worked.
How can i change this code snippet so following elements won't be in new line?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,您无法更改 Google 在您的页面中注入的内容,但您可以在页面上使用
CSS
对其进行适当的样式设置。You cannot change, to my knowledge, what Google is injecting in your page but you can style it appropriately with
CSS
on your page.您可以使用 div 标签将其与 facebook 按钮对齐...看看...
在此之前您需要运行一个强制性的脚本:
这对您有用。
You can use div tag to place it in line with facebook button... Have a look...
Before this you need to run a script which is mandatory:
This will work for you.