html - Resizing Text Element -


i trying text element vertically centered in larger div, colored in blue. defined height , alignment follows:

vertical-align: top; //middle puts lower height: 83px; //the same larger area 

however, cannot vertically aligned in center of blue box. appreciated!

my image

you can in several ways:

  1. center division:

div.div{    text-align: center;  }
<div class="div">     hello world!   </div>

  1. use p tag align text center

div.div{    background-color: #00ff00  }  p.p{    text-align: center;  }
<div class="div">    <p class="p">hello world!</p>   </div>


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -