I want to add custom CSS for a single post. I use the Custom HTML block for the HTML, but I can’t find how to add custom CSS. I added custom CSS in Customize –> Additional CSS , but it displays in the entire site.
Is there a way to add custom CSS code to one particular post only, not on every post. I don’t want extra code to load to slow my website down.
in the HTML block you can add your CSS, simply wrap it in style tags ie.
<style>
your CSS here
</style>
as a general rule, if you’re adding a few lines of CSS, then don’t be bothered doing this, it won’t make any real performance improvements over adding it to the customizer.
IF however your’re loading 100 to 1000s of lines of CSS on a specific page then you will want to consider a child theme and enqueueing stylesheets for that.