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

前端 未结 5 1590
刺人心
刺人心 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:22

    **You can change font-size:10vh;**
            .parent {
          width:70%;
          height:auto;
          min-height:100px;
          background:red;
          color:white;
          font-size:10vh;
        }
        Please help me to change the font-size dynamically to the parent class
        
    Text

提交回复
热议问题