如何编辑wordpress主题背景?
我的系统上安装了 WordPress。我使用的是二十个主题,在主题目录中有 style.css 文件。在该文件中,我尝试过
body {
background-color: red;
}
,但没有任何反应,无论 style.css 发生什么变化,它都不会反映在浏览器中。 请帮忙。
I have wordpress installed on my system. I am using twentyten theme, in the theme directory there is style.css file. In that file I tried
body {
background-color: red;
}
but nothing happens, no matter what change in style.css it does not reflects in browser.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您清除浏览器的缓存了吗?通常浏览器会缓存 css 文件以提高效率,因此您对其进行的任何更改都需要清除缓存。
如果您使用的是 Windows 计算机:
ctrl + shift + del
应该会弹出清除缓存对话框编辑:看来您的 css 位于
@media 中样式表的 print
部分 - 仅适用于印刷材料Have you cleared your browser's cache? Often the browser will cache the css files to be more efficient, so any changes you make to it require you to clear the cache.
If you're using a windows machine:
ctrl + shift + del
should bring up the clear cache dialogEdit: it appears that your css was in the
@media print
section of the stylesheet - which only applies to printed material解决这个问题的最佳方法是在 Firefox 中安装 Firebug 或使用 Chrome 中的内置 Inspector。
右键单击页面,执行“检查元素”并检查检查器告诉您的内容。您设置的背景颜色可能被另一个样式规则所否决(检查器会告诉您这一点),或者有其他具有其他背景颜色的元素被放置在主体顶部,从而隐藏了红色背景颜色。
无论哪种方式,执行“检查元素”都会使这一点变得清晰。我们只能从这里猜测。
The best way to figure this stuff out is to install Firebug in Firefox or use the built-in Inspector in Chrome.
Right-click on the page, do 'Inspect Element' and check what the Inspector tells you. Probably the background-color you're setting is being overruled by another style rule (Inspector will tell you this) or there are other elements with another background-color which are placed on top of the body, thus hiding the red background-color.
Either way, doing an 'Inspect Element' will make this clear. We can only guess from here.
首先确保您正在编辑正确的样式表。例如,尝试删除此文件中的所有样式代码并刷新您的网站。如果您失去了自己的风格,那么您来对地方了。
第二次尝试使用 Firebug Addon 它将帮助您检查 html 元素,然后您可以显示该元素相应的 CSS。您可以更改任何您想要的内容并直接在页面上查看效果,然后您可以将这些更改写入样式表。
希望对你有帮助。
First of all ensure that you're editing the right style sheet. For example try to erase all the styling code inside this file and refresh your website. If you loose your style then you're in the right place.
Second try to use Firebug Addon it will help you to inspect the html Element then you can show the corresponding CSS for this element. you can change whatever you want and see the effects directly on your page then you can write these changes to the style sheet.
hope it helps you.
也许该样式被正文下面几行的另一个背景属性覆盖(浏览器将始终渲染元素的最后一个 css 属性)。您可以使用 firebug 轻松检查的内容。
如果您有插件,请禁用它们以确保安全。
除此之外以及已经提出的建议我不完全确定可能导致这种情况的原因
Maybe that style is overwritten by another background attribute on the body a few lines below (browser will always render the last css attributes of elements). Something you can check easily with firebug.
If you have plugins, disable them just to be sure.
Other then that and the suggestions already made I'm not entirely sure what could cause this