Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change font height and width

Tags:

html

css

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:

enter image description here

the text would be stretched to half:

enter image description here

Is this possible to do using CSS?

like image 736
cabralpinto Avatar asked Oct 04 '15 10:10

cabralpinto


People also ask

How do I increase the width of a font in 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.


2 Answers

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.

like image 161
Sebastian Simon Avatar answered Sep 30 '22 06:09

Sebastian Simon


You can try scaling the font in x direction.

p{     -webkit-transform: scaleX(0.5);     transform: scaleX(0.5); } 
like image 38
Aakash Avatar answered Sep 30 '22 05:09

Aakash