Typography: Target inline code elements only #12496
Replies: 5 comments 1 reply
-
Lost more time than I'm willing to admit looking for a solution. Was trying to do this today and it was such a lifesaver 💪 (this is what I call timing). I wish this would be part of core utilities, since you cannot style |
Beta Was this translation helpful? Give feedback.
-
I think the fact that it currently targets code elements in pre elements is honestly a bug, haha. Feel free to make an issue on the typography repo 💀 |
Beta Was this translation helpful? Give feedback.
-
For posterity, here's the issue: tailwindlabs/tailwindcss-typography#329 |
Beta Was this translation helpful? Give feedback.
-
For those who copied the above snippet and having some tailwindcss intellisense issues or snippet not working you need to also import the plugin
|
Beta Was this translation helpful? Give feedback.
-
I just wanted to leave this here in case anyone ever needs it.
If you're trying to target
code
elements that are not wrapped inpre
blocks with Tailwind Typography, you can add this variant to yourtailwind.config.js
.You can use
prose-inline-code:{utility}
to target inline blocks now.I think the selector is right, but it definitely works. I tried to mirror the default prose ones.
You can read more here: https://aaronfrancis.com/2023/tailwind-typography-inline-code-only
Beta Was this translation helpful? Give feedback.
All reactions