Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superscript inside a p:after content tag

.class {
    &:after {
        content: "m3/s";
    }
}

I want to add a unit declaration via :after tag. Is it possible to make the 3 superscript?

This obviously doesn't work:

.class {
    &:after {
        content: "m<sup>3</sup>/s";
    }
}
like image 603
KSPR Avatar asked Apr 14 '26 02:04

KSPR


1 Answers

You can't style generated content partially (with the exception of combining :first-letter and :before), so no. You could use U+00B3 SUPERSCRIPT THREE instead:

.class {
    &:after {
        content: "m\00B3/s"; /* Or content: "m³/s"; */
    }
}

... but I would recommend putting this as actual content and either using U+00B3, &sup3; or the <sup> element if it is semantically important.

like image 200
BoltClock Avatar answered Apr 21 '26 04:04

BoltClock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!