It works, but I would like to add a property in frontmatter for this CSS to apply on selected notes only, instead of my entire vault. Is there a way to do so? Thanks in advance.
Adding a custom class before what you have (with a space) should do it. The class can be pretty much anything as long as it’s not used somewhere else in your vault.