Log in

View Full Version : question about vertical-align in this specific case



kobo1d
04-26-2010, 11:10 AM
hi there...

i have found this article on the net:
http://stackoverflow.com/questions/2180590/how-do-you-vertically-align-images-within-a-list-or-a-div

as you can see they work with line-height and vertical-align to vertically center an image inside ul/li tags in a div... now this works cool, but.....

if you also have an a(link)-tag before the image, not only the image (exact border) is a hyperlink, instead the whole line-height area is the link..
now what i need is a vertical-center but the link should be wraped exactly around the img tag and not for the whole line-height defined space...

i hope you do understand what i mean!

thx for any help !!!



btw here is the css for my div (which is also centered to the middle of the page):


width: 100%;
height: 400px;
position: absolute;
top: 50%;
margin-top: -200px;
white-space: nowrap;
z-index: 1;

this is the css for the ul/li


line-height: 400px;

and thats the img inside ul/li


vertical-align: middle;


plz help me!!!

katierosy
04-30-2010, 02:21 PM
The code seems to be working fine. Can you add the demo link to verify? there may be a chance of Overriding some css property by other class / ID.