Archived topic
How to deal with a lot of CSS
3 replies · Started by Kevin on January 8, 2021
Hi there,
I have three general questions, all about how to deal with CSS. I hope that's fine.
First, I was wondering at which point it is better to use a child theme. I am constantly changing the layout of GP with CSS. Right not it's about 200-300 lines of CSS code. While this is not that much, it will certainly increase over time. Though, GP's documentation states: "if all you’ll be doing is adding CSS or PHP, a child theme probably isn’t necessary." Is this true for any code length?
Secondly, I created some alert boxes, tables, info boxes... in html. All of these require CSS for styling. Is it good practise to add all of this CSS to "additional CSS"?
Thirdly, I need some CSS to only apply on a specific page or post. What is good practise here? It probably is not a good idea to put all the CSS in "additional CSS" (which is ecactly what I am doing right now). Is using a metabox like the one offered by the plugin simple CSS the solution? Or perhaps separate CSS files that are loaded into the page?
Thank you for the support and keep up the good work,
cheers!
Hi there,
200 - 300 lines is not an issue - once you start getting closer to 500 - 600 lines then you may want to consider a Child Theme for the styles.
As you're using the Simple CSS plugin then i would suggest you use that for all your CSS, no point having it split in two. This includes the CSS you require for your Custom HTML elements.
Simple CSS Meta box is the simplest way to go for adding page specific CSS.
Thanks David, I appreciate your help!
You're welcome