Search code examples
htmlcssscalecpu-word

CSS word vertical scale


I want to place the word vertical-align:middle. (Always in the middle of div when scaling the browser). I have tried a lot of methods but fail to keep it in the middle when scale. How can I do that?

<div class="word">
    <h1>Hello!!</h1>
</div>

Solution

  • You can try this basic approach:

        .word {
            height: 90px;
            background: #000;
            color: #FFF;
            line-height: 90px;
        }
        h1{
          font-size:5.9vw;
        }
      <div class="word">
         <h1>Hello!!</h1>
      </div>