Closed. This question is opinion-based. It is not currently accepting answers.admin管理员组文章数量:1425699
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this questionBy better i guess i mean which works faster when rendering the page. I understand that the additional css editor stores the changes in the database. Does that make it quicker or slower than using styles.css in a child theme.
Are there any other considerations, such a maintainability?
Closed. This question is opinion-based. It is not currently accepting answers.Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this questionBy better i guess i mean which works faster when rendering the page. I understand that the additional css editor stores the changes in the database. Does that make it quicker or slower than using styles.css in a child theme.
Are there any other considerations, such a maintainability?
Share Improve this question asked Jun 11, 2019 at 4:55 PJSANTAPJSANTA 133 bronze badges 2- performance difference is probably negligible, but files are browser cached so that is a plus... but also can be annoying if you are changing styles regularly so best to add some dynamic cachebusting (eg. via the version string.) – majick Commented Jun 11, 2019 at 5:14
- see this answer to do that: wordpress.stackexchange/a/294663/76440 – majick Commented Jun 11, 2019 at 5:15
1 Answer
Reset to default 3It depends on your circumstances. There are, however, several things to consider:
Loading
CSS added to Additional CSS is added inline in a <style>
tag at the head of every page. This means that if you have lots of CSS you'll increase the size of all your pages individually. So the browser will be essentially forced to download your custom styles multiple times.
On the other hand, while adding CSS to a stylesheet file means that the browser needs to download an additional stylesheet, it also means that the browser can cache the file so the additional styles don't need to be downloaded again for each page.
Setup
If you go with a stylesheet file you have to set up a child theme. This means you need to create a new theme directory, create a style.css file, including the theme header. Then you need to create a functions.php file to properly load the stylesheet, as well has the parent theme's styles. Parent themes all work differently, so this process can be tricky.
So creating a child theme is a lot more effort that just using the Customiser.
Maintaining
Adding CSS to Additional CSS means that you need to use the editor in the Customiser, which is quite narrow, and not well suited to large quantities of CSS.
If you add them in a stylesheet though, you can use whichever text editor you like, at a more comfortable size.
Given the above, my suggestion would be that if you're making small tweaks and changes, then use the Customiser, but if you want to significantly change the design with lots of CSS, create a child theme and use a stylesheet file.
Not that you mentioned it, but just to make to clear to any passers-by: under almost no circumstances should you edit your theme's stylesheet. You should either use the Customiser or create a child theme.
本文标签: Is it better to put CSS in additional CSS or in Child theme stylescss
版权声明:本文标题:Is it better to put CSS in additional CSS or in Child theme styles.css 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745411257a2657479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论