You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per font all values except for the line height are constant. So it would be possible to replace the fixed em values used as negative margins with a calc() using the lh unit.
This way the rules inside ::before and ::after would be font-size and line-height independent and would also allow other units like rem for font-sizes.
The overall support for the lh-unit is quite good, but can't be considered universally available.
(Alternatively, to widen support, it can be considered to use a custom property for the line height.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Per font all values except for the line height are constant. So it would be possible to replace the fixed em values used as negative margins with a
calc()
using thelh
unit.where
This way the rules inside ::before and ::after would be font-size and line-height independent and would also allow other units like
rem
for font-sizes.Here is a codepen demo:
https://codepen.io/2pinch/pen/VYZNGRy
The overall support for the lh-unit is quite good, but can't be considered universally available.
(Alternatively, to widen support, it can be considered to use a custom property for the line height.)
Beta Was this translation helpful? Give feedback.
All reactions