Can I Elongate Text Vertically in CSS Without Changing Font Size?

Linda Hamilton
Release: 2024-10-26 18:36:03
Original
972 people have browsed it

Can I Elongate Text Vertically in CSS Without Changing Font Size?

Elongating Text with CSS

Question:

Is it possible to stretch text vertically using CSS without enlarging the font size?

Answer:

Yes, CSS 2D Transforms allows you to achieve this effect in most modern browsers.

Implementation:

  1. Define a CSS class for the stretched text:
span.stretch {
    display:inline-block;
}
Copy after login
  1. Apply the transform property to scale the text vertically:
-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 */
Copy after login

Usage:

<p>I feel like <span class="stretch">stretching</span>.</p>
Copy after login

This will display the text "stretching" stretched vertically by a factor of 2.

The above is the detailed content of Can I Elongate Text Vertically in CSS Without Changing Font Size?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!