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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -