I am required to stretch text horizontally, but the only thing I could find was font-stretch which, according to w3schools, isn't supported by any browser.
Is there any other way which I can meet this effect?
use CSS transform:scaleY(yValue) to stretch it vertically, on the Y axis. This might pixelate the text in some browsers. An alternative is to use SVG text, then apply transform="scale(0, yValue)" attribute, which will not pixelate (it's a vector!).
Yes - you can achieve this by using CSS 2D transforms.
Here's a working JSFiddle.
Note that the example in the Fiddle/code below is for Chrome/Safari (WebKit), however, you can use 2D transforms in all major browsers by using the -moz-
, -o-
, and ms
equivalent prefixes/methods!
HTML:
<span>Hello!</span>
CSS:
span {
transform:scale(3,1);
-webkit-transform:scale(3,1);
display:inline-block;
}
Support:
It is supported in Chrome, Firefox, IE9+ and Opera browsers.
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