How Can I Vertically Center An Image With An Anchor Inside A Div?
I have a row of DIVs for my navigation and I'm trying to vertically center an image with an anchor inside them using only CSS. I tried vertical-align: middle; but that isn't workin
Solution 1:
Don't know why you are using li to hold the anchor element. From the question there is no mention for the li. So I assume you just need one image and one anchor. Check this out:
Basically you just need to have the helper to have 100% height of the container div. And you need to use
vertical-align: middle;
display: inline-block;
on all child elements in the container div to make them vertically aligned.
Post a Comment for "How Can I Vertically Center An Image With An Anchor Inside A Div?"