问题描述
我知道已经有人问过这个问题,但是那个人有错字,答案中提到了萤火虫,所以它不是最新的(并且已经关闭).
I know it's already been asked but that person had a typo, and the answer mentioned firebug so it's not current (and is closed).
在 WordPress 中,我注意到未应用主文件 style.css ,具体是:
In WordPress, I noticed that main file, style.css is not being applied, specifically:
- 文件已正确加载
- 未应用其样式
当我检查某个元素的元素时,我知道它是由style.css定位的,而style.css中的任何内容(inspect元素的样式"选项卡)根本没有.我已经检查了几个要素.
When I inspect element for an element I know is being targeted by style.css, nothing from style.css is there (styles tab of inspect element) at all. I've inspected several elements.
它是通过WordPress加载的(通过_underscores生成的不变调用):
It's loaded through WordPress as so (an unchanged call generated with _underscores):
wp_enqueue_style( 'themexzz-style', get_stylesheet_uri(), array(), _S_VERSION );
这是产生的链接(单击它的效果应该像预期的那样):
This is the produced link (and clicking on it works like it's supposed to):
<link rel='stylesheet' id='themexzz-style-css' href='http://localhost:8012/themexzz/wp-content/themes/themexzz/style.css?ver=1.0.0' media='all' />
我正在使用
- Xampp 与 php 7.2.3
- 使用wordpress 5.5.3
- 元字符集="UTF-8"
- 数据库排序规则为utf8mb4_unicode_ci
- 这是一个下划线生成的主题
谢谢.
推荐答案
@Xhynk-您说得对.那是:
@Xhynk - You were right. It was the:
因为它是一个下划线主题,并且我从另一个文件应用了自己的CSS,所以我什至没有想到style.css中可能存在无效的CSS
As it is an underscores theme and I apply my own CSS from another file, it didn't even cross my mind that there might be invalid CSS in style.css
谢谢@Xhynk
这篇关于CSS已加载但未应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!