如何隐藏 google +1 按钮?
我在 div 中有一个 google +1 按钮,该按钮最初应该是隐藏的,并且应该更改点击事件的可见性。 div 中的其他所有内容都工作正常,但由于某种原因,按钮不会继承 div 规则,并且它保持永久可见:
<div id="sharethisdish">
...
<g:plusone size="small" count="false" ></g:plusone>
</div>
我尝试在 html 中为按钮提供自己的样式,并为其提供 id 并定义样式在我的 css 页面中,但它似乎不遵循任何规则。有谁知道如何更改其可见性?
I have a google +1 button in a div which is supposed to be initially hidden and should change visibility on a click event. Everything else in the div works fine but for some reason the button won't inherit the div rules and it stays permanently visible:
<div id="sharethisdish">
...
<g:plusone size="small" count="false" ></g:plusone>
</div>
I've tried giving the button its own styling in the html as well as giving it an id and defining the styling in my css page but it doesn't seem to follow any rules. Does anyone know how to change its visibility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果隐藏/显示是在单击时完成的,那么它很可能正在应用内联样式。这意味着内联样式将覆盖 css 文件中设置的样式。
您可以使用
!important
并且我相信这应该覆盖点击时应用的样式。If the hiding/showing is being done onClick then chances are that it is applying the style inline. Which means the inline style will override the one set in your css file.
You could use
!important
and I believe that should override the style being applied on click.这应该可以解决您的问题:
HTML:
JS:
Now make onclick 事件将使 d.style.display = "inline";
This should solve your problem:
HTML:
JS:
Now make onclick event that would make d.style.display = "inline";