admin管理员组文章数量:1430605
I need advice how to modify Gutenberg's core CSS.
What's my problem: the outlines and block labels disappear and I want them fixed, visible on every block all the time, not only in focus.
I've found GB gets his styles from something called wp-admin/load-styles.php
which basically got me nowhere. All the styles merge via that load-styles.php
file. I don't know where to look for that class for the outline.
Additionally, most CSS files I found wherever are x4 - minified and and alternative for RTL.
Which file and which version of it should I modify? Or maybe there is another approach?
I need advice how to modify Gutenberg's core CSS.
What's my problem: the outlines and block labels disappear and I want them fixed, visible on every block all the time, not only in focus.
I've found GB gets his styles from something called wp-admin/load-styles.php
which basically got me nowhere. All the styles merge via that load-styles.php
file. I don't know where to look for that class for the outline.
Additionally, most CSS files I found wherever are x4 - minified and and alternative for RTL.
Which file and which version of it should I modify? Or maybe there is another approach?
Share Improve this question edited May 3, 2019 at 21:05 norman.lol 3,2413 gold badges30 silver badges35 bronze badges asked May 3, 2019 at 20:38 polish bastardpolish bastard 472 silver badges5 bronze badges 01 Answer
Reset to default 5To override Gutenberg's styles you need to add your own stylesheet. So hook into enqueue_block_editor_assets
and then add your own stylesheet in which you target the selectors you wanna override. In the following example I placed a stylesheet in a custom theme's assets/
folder.
functions.php
:
// Add backend styles for Gutenberg.
add_action('enqueue_block_editor_assets', 'gutenberg_editor_assets');
function gutenberg_editor_assets() {
// Load the theme styles within Gutenberg.
wp_enqueue_style('my-gutenberg-editor-styles', get_theme_file_uri('/assets/gutenberg-editor-styles.css'), FALSE);
}
assets/gutenberg-editor-styles.css
:
.editor-post-title__input {
border: 1px solid black;
}
Source: Creating theme editor styles for Gutenberg
本文标签: block editorHow to override Gutenberg admin CSS
版权声明:本文标题:block editor - How to override Gutenberg admin CSS 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745525704a2661825.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论