【问题标题】:WordPress body margin-top issueWordPress 正文页边距问题
【发布时间】:2012-12-22 02:18:47
【问题描述】:

所以,我正在制作一个自定义 WordPress 主题,您可以在 http://staging.gencormortgage.com/sandbox/wordpress/ 看到它。它在所有浏览器中都能正常显示,但谷歌浏览器(可能还有 Safari,无法测试那个) - 我希望顶部的线条一直位于屏幕顶部。我试过body{ margin-top:0 auto; },但这仅适用于 Opera 和 Firefox,但在 Google Chrome 的顶部有 28px 的空白区域。如果我将margin-top 更改为-28px,它在 Opera 和 Firefox 中无法正常显示。我该如何克服这个浏览器兼容性问题?

【问题讨论】:

  • 我也不应该在主题的头部使用<?php wp_head(); ?>,在我的自定义样式表之前。
  • “一直在屏幕顶部”是什么意思?我正在使用 chrome,我在顶部看到一条绿色和灰色的线,所以我假设它应该是这样的。
  • - I want the lines at the top to be all the way at the top of the screen. 你能澄清一下你的意思吗?
  • @AehmloLxaitn 试试我的答案。

标签: php html css wordpress


【解决方案1】:

那是管理栏。

您可以通过在funcitons.php中加入以下内容来禁用它

wp_deregister_script('admin-bar');
wp_deregister_style('admin-bar');
remove_action('wp_footer','wp_admin_bar_render',1000);

顺便说一句,它仅在您登录时显示。

或者你可以下载一个lite plugin来隐藏它。

【讨论】:

  • 谢谢,我会将其标记为答案,因为它是针对我的情况提供的最佳答案。将add_filter('show_admin_bar', '__return_false'); 添加到我的functions.php 解决了我的问题。谢谢!
猜你喜欢
  • 2019-07-25
  • 2012-03-14
  • 2018-01-11
  • 2011-08-05
  • 1970-01-01
  • 2018-10-04
  • 1970-01-01
  • 2011-09-12
  • 1970-01-01
相关资源
最近更新 更多