Just use position: absolute in the pseudo-element ::after {} css:
span.my:after { content: " text that is supposed to come after the box"; position: absolute; left: 100%; }β
Remember, of course, to use position: relative; (or any other position value) in the span.my parent element.
JS Fiddle demo .
Also remember that since the pseudo-element ::after (and ::before ) inherits from the range to which it is attached, that it inherits width , so perhaps it should be explicitly redefined in CSS for these / those elements.
David thomas
source share