I’m not sure if there’s any HTML way to do it, but you can fix it by adding a zero-width joiner Unicode character before the opening span tag:
<p>كت‍<span style="color: Red;">ب</span></p>
You can use the actual Unicode character instead of the HTML character entity, of course, but that wouldn’t be visible here. Or you can use the prettier ‍
entity.
Here it is in action (using an invisible <b>
tag, since I can’t do color here), without the joiner:
كتب
and with the joiner:
كتب
It’s supposed to work without the joiner as far as I understand it, though, and it does in some browsers, but clearly not all of them.