Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center h2 inside a div - very basics

I want to center h2 inside #top but vert-aliignt middle doesnt work same auto margin... I ave no idea what to do!

#top {
    display: block;
    position: relative;
    height: 100px;
    background-color: rgba(89,144,222,.6);
}
#top h2{
    text-shadow: 2px 2px black;
    text-align: center;
    color: white;
    font-family:"Impact";
    font-size: 50px;
}

effect is - enter image description here

like image 279
Filip Bartuzi Avatar asked Mar 23 '13 17:03

Filip Bartuzi


1 Answers

Set line-height:100px; vertical-align:middle on #top.

like image 109
Joe Frambach Avatar answered Sep 18 '22 13:09

Joe Frambach