Is it possible to adapt font size to div width with CSS?

前端 未结 5 1589
刺人心
刺人心 2020-12-15 17:47

I have a div with 70% width, and here’s what I want to do:

  • Put some words in that div
  • Adapt font size so that those words occupy all div
5条回答
  •  既然无缘
    2020-12-15 18:09

    Here, I Updated it.... JS Fiddel

    try to use

    css

    .parent 
     {
          width:70%;
          height:auto;
          min-height:100px;
          background:red;
          font-size:10vw;          
      }
    
    
    
    span{
          display:inline-block;
          transform:scale(1.8,1);
          -webkit-transform:scale(3,1);
     }
    

    HTML

    This Text

提交回复
热议问题