I want to change not the font-size
of text, but two independent properties relative to its width and height. So, by applying font-width: 50%
to this element:
the text would be stretched to half:
Is this possible to do using CSS?
The font-stretch property allows you to make text narrower (condensed) or wider (expanded). Note: Some fonts provide additional faces; condensed faces and expanded faces. For these fonts, you can use the font-stretch property to select a normal, condensed, or expanded font face.
CSS transform
has the scale
function for this:
p { display: inline-block; font-size: 32px; transform: scale(.5, 1); }
<p>This is text.</p>
Use the two numbers in the function for X- and Y-axis respectively.
You can try scaling the font in x direction.
p{ -webkit-transform: scaleX(0.5); transform: scaleX(0.5); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With