admin管理员组文章数量:1320591
How can I ensure that for a given Wordpress HTML block, it uses just the css I provide in my (large) style.css file. I've placed the style.css file in a plugin, it looks good, but Wordpress insists on lengthening some of the graphics and squishing others.
Everything looks great when I view the HTML file in a browser outside of Wordpress, and I'd hate to have to stick !important on every single attribute and add probably quite a few dozen more.
It looks like the following post helped with my problem:
How can I ensure that for a given Wordpress HTML block, it uses just the css I provide in my (large) style.css file. I've placed the style.css file in a plugin, it looks good, but Wordpress insists on lengthening some of the graphics and squishing others.
Everything looks great when I view the HTML file in a browser outside of Wordpress, and I'd hate to have to stick !important on every single attribute and add probably quite a few dozen more.
It looks like the following post helped with my problem:
https://stackoverflow/questions/7896536/ordering-wordpress-stylesheets
Share Improve this question edited Oct 3, 2020 at 22:29 Mr No asked Oct 3, 2020 at 20:47 Mr NoMr No 11 bronze badge 4 |1 Answer
Reset to default 0You can't, not without isolating the insides of the block. This means you would need to use an iframe or build a web component. This will require significant effort, and also carry lots of downsides and new problems.
Instead, investigate CSS specificity as fundamentally it's a CSS problem not a WordPress problem. Note that by specificity I don't mean put !important
on every rule
本文标签: pluginsApply only the css in my stylecss file
版权声明:本文标题:plugins - Apply only the css in my style.css file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742084313a2419886.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_enqueue_style()
has a$deps
parameter to enqueue your css after another specific CSS file. If another file is overwriting your CSS you need to get more specific or you need to enqueue after it to ensure your CSS has priority. I'm not sure this question is going to be answerable in its current format. – Howdy_McGee ♦ Commented Oct 3, 2020 at 20:54