Can I stretch text using CSS?

后端 未结 6 2115
暖寄归人
暖寄归人 2020-11-28 03:19

Can I stretch text in CSS? I don\'t want the font to be bigger, because that makes it appear bolder than smaller text beside it. I just want to stretch the text vertically s

6条回答
  •  有刺的猬
    2020-11-28 03:58

    Yes, you can actually with CSS 2D Transforms. This is supported in almost all modern browsers, including IE9+. Here's an example.

    Actual HTML/CSS Stretch Example

    HTML

    I feel like stretching.

    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 */
    }
    

    TIP: You may need to add margin to your stretched text to prevent text collisions.

提交回复
热议问题