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!
you can in several ways:
- center division:
div.div{ text-align: center; }
<div class="div"> hello world! </div>
- 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
Post a Comment