Home > Web Front-end > CSS Tutorial > Can you vertically stretch text using CSS without making it appear larger?

Can you vertically stretch text using CSS without making it appear larger?

Linda Hamilton
Release: 2024-10-28 02:18:02
Original
622 people have browsed it

Can you vertically stretch text using CSS without making it appear larger?

CSS Transform: Text Transform

Can you stretch text using CSS? You don't want the font to be larger because that will make the text appear thicker than the smaller text next to it. You just want to stretch the text vertically, deforming it. This should be in one div and the normal text in another div next to it. How do you do this?

Solution: Use CSS 2D Transforms

Actually, you can use CSS 2D Transforms to achieve this. Almost all modern browsers (including IE9) support this feature. Here is an example:

<code class="html"><p>I feel like <span class="stretch">stretching</span>.</p></code>
Copy after login
<code class="css">span.stretch {
    display:inline-block;
    -webkit-transform:scale(2,1); /* Safari and Chrome */
    -moz-transform:scale(2,1); /* Firefox */
    -ms-transform:scale(2,1); /* IE 9 */
    -o-transform:scale(2,1); /* Opera */
    transform:scale(2,1); /* W3C */
}</code>
Copy after login

The above is the detailed content of Can you vertically stretch text using CSS without making it appear larger?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template