Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vertical align not working

is it possible to vertically align an image coming inside an anchor tag ?

I am using two anchor tags inside a DIV.. each one should vertically align to center. in one I am using an image in another one text ?

PS: without line-height

like image 696
Joemon Avatar asked Nov 29 '22 04:11

Joemon


2 Answers

Vertical align does not behave as you'd think in divs since it works only for table cells.

There are numbers of CSS "hacks" to get that to work such as this one or this one

like image 140
marcgg Avatar answered Dec 19 '22 04:12

marcgg


Try this:

div{
    display: table-cell;
    vertical-align: middle;
}
like image 33
Jason Ellis Avatar answered Dec 19 '22 05:12

Jason Ellis