While many may doubt its feasibility, I am determined to prove them wrong.
Indeed, it is possible.
Admittedly, it may be a crude workaround, but it can be achieved.
To accomplish this, we will utilize two key CSS functionalities:
Firstly, CSS allows for the modification of text flow direction. While typically used for languages like Arabic or Hebrew, it can reverse the display order of any text, including English. For instance, to display the word "String" in reverse on an element, the markup would need to be "gnirtS".
Secondly, CSS includes the ::first-letter
pseudo-element selector, which targets the initial letter in a text. (although there is no equivalent ::last-letter
selector)
By combining the ::first-letter
with the reversed text, we effectively highlight the first letter of "gnirtS" which visually appears as the last letter of "String".
div {
float: left;
unicode-bidi: bidi-override;
direction: rtl;
}
div::first-letter {
color: blue;
}
<div>gnirtS</div>
Indeed, this technique does work - a demonstration can be viewed in this working fiddle.
However, it must be acknowledged that this method is somewhat unconventional. Reversing text manually is not a practical solution, despite providing an answer to the query.