sorry if this is the wrong topic to post this to but has anyone here figured out, how to style codeblocks and inline-code in Callouts only while not styling any code outside of Callouts? I checked inspect element but they seem to have the same selectors as normal inline-code/codeblocks. I tried it myself but everything I have tried so far either didn’t change anything or changed all codeblocks even the ones outside of callouts. My knowledge of CSS is too little to actually figure this out myself, I believe.
Could anyone maybe tell me both?
How to style codeblocks and inline-code in Callouts only (live preview and reading view)?
How to style codeblocks and inline-code in Callouts for a customclass you add to the frontmatter ( the cssclasses in the properties section/YAML). For example: cssclasses: helper. Also for live preview and reading view.
You can target callouts in obsidian with .callout {} CSS class. However, you will need a basic unterstanding of selectors and combinators to achieve what you want. Then you can target everything within a callout.
I understand that combinators are the general concept involved, but the missing piece was Obsidian’s specific callout DOM structure. “.callout {}” only targets the whole container, while the useful selectors were “.callout-title-inner code”, “.callout-content code”, “.callout-content pre”, and “.callout-content pre code”.
That distinction was the actual issue, especially because inline code in the callout title for example is outside “.callout-content”.