What's the best practice for CSS that is specific to one PHP file?

For example, let's say I make a page page-456.php that is styled differently from the rest of the site, what's the best practice to style it and keep my HTML/text ratio good?

I did have a look and a few solutions came up - enqueuing etc. but I'm not sure if that's designed for use with templates only?

  • Does this answer your question? Multiple Page Templates & CSS
    – YourManDan
    Mar 1 at 17:45
  • can you rephrase your question so that it's less of a discussion topic and instead an explicit question? This isn't a discussion forum and you need to be able to mark an answer not as the best practice answer, but as the correct answer for all users, not just the most useful advice. If your question isn't phrased in a way that it can have a concrete answer written for it then it might be closed as offtopic/subjective/broad
    – Tom J Nowell
    Mar 1 at 18:03
  • I would just add a <style> block in your page-456.php file. Mar 2 at 5:04
  • This is what I would normally do, but I think it's affecting my html/text ratio - do you know if there's a way around that?
    – Coopero
    Mar 2 at 9:52


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.