Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
My style.css被wordpress default style.min.css覆盖_Wordpress - Fatal编程技术网

My style.css被wordpress default style.min.css覆盖

My style.css被wordpress default style.min.css覆盖,wordpress,Wordpress,从一段时间以来,我一直在为WordPress的风格而挣扎 我在my.css中为一个块定义了一个样式,在网站中,这个样式被style.min.css覆盖。因此,如果WordPress希望默认的颜色是绿色,我可以通过将!到处都很重要。太难看了 function wpdocs_theme_name_scripts() { wp_enqueue_style( 'style.css', get_stylesheet_uri() ); } add_action( 'wp_enqueue_script

从一段时间以来,我一直在为WordPress的风格而挣扎

我在
my.css
中为一个块定义了一个样式,在网站中,这个样式被
style.min.css
覆盖。因此,如果WordPress希望默认的颜色是绿色,我可以通过将!到处都很重要。太难看了

function wpdocs_theme_name_scripts() {
    wp_enqueue_style( 'style.css', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
这就是我如何在WordPress 5.3.2中的我自己编写的主题中加载我的标准
style.css


因此,如果有人知道,我怎么能告诉WordPress在style.min.css之后加载我的
style.css
,或者任何导致这种不便的东西。

将你的
style.css
参数更改为
你的主题样式css
经过反复试验,我慢慢地相信,问题的根源在于css本身。“.wp-block-cover.wp-block-cover\uuu-inner-container”是wordpress类。我的类只是“.wp-block-cover\uuu-internal-container”,因为我更喜欢让选择器尽可能简短和基本。 但是,如果我将类名更改为WordPress使用的完全相同的名称,它就会工作。此外,如果我只是把任何其他类放在前面,则样式将正确应用

所以,现在对我来说,这似乎是CSS的一个优先问题。这可能吗?

用于为CSS规则分配更高的优先级。

具有讽刺意味的是,您希望“使选择器尽可能简短和基本”的愿望对您不利,但提供的链接将帮助您构建高优先级、特定的CSS选择器

注意:Wordpress不会“覆盖”你的.css文件。我们知道这一点,因为当您添加
时,您的CSS会应用!重要信息
到规则——因此,必须加载CSS规则,因此这是CSS优先级问题,而不是Wordpress问题。另外,请注意CSS规则从不相互“覆盖”;相反,所有规则都存在,但只使用一个(通常是最具体的一个)