You're running into a common issue with Tailwind CSS's Typography plugin (also known as @tailwindcss/typography or the "prose" class). By default, the plugin applies its own styles to tags like <strong> inside your content—including setting their color to the current text color, which overrides custom inline styles (such as your Tiptap output).
The Problem:
.prose sets color on <strong> (and <b>) to inherit, which means the color value from the <span> style is not taking effect as expected.
Solution 1: Override the Typography Styles with Custom CSS
You need to ensure that <strong> and <b> tags inside spans with a style actually inherit the color from the span instead of being reset by the Typography plugin.
Add this CSS to your project:
.prose span[style] strong,
.prose span[style] b {
color: inherit !important;
}
- This selector ensures that if a
<strong>or<b>is inside a styled span, it will inherit the color from that span, instead of being overridden by the prose styles. - The
!importantis necessary because the prose plugin adds fairly specific rules.
Solution 2: Tailwind Config (More Complex, Less Direct)
You can extend the Typography plugin's theme in your tailwind.config.js, but it's tricky because the plugin targets elements globally, and not based on parent/child relationships.
A Tailwind config approach is not enough here—the above CSS override is much more reliable.
Apply the Fix
- Create a CSS file (e.g.,
resources/css/overrides.css) if you don't have one. - Add the above CSS code to it.
- Make sure it's imported after your Tailwind CSS styles, so it overrides them.
Example
Supposing your Tiptap output is rendered like this:
<div class="prose">
<p>ceci <span style="color:rgb(255,0,0);">est </span>
<span style="color:rgb(255,0,0);"><strong>un test</strong></span>
</p>
</div>
After applying the CSS override, “un test” should correctly appear bold and red.
Summary:
The correct and most future-proof fix is to selectively override the prose styles for strong/b inside styled spans as shown above.
Let me know if you need a live example or further tweaks!