That doesn't work either
Main Topics
Browse All TopicsI'd like to vertically center an image within a div. I am using the HTML below but with no luck. What am i doing wrong?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use the background-position property:
http://www.w3schools.com/c
Look at this and see if this helps:
http://www.dynamicsitesolu
You should be able to center text, images and in-line elements using line-height.
BTW, the DOCTYPE needs to be specified as:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtm
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtm
in order for line-height and vertical-align:middle to work.
i just put the image in a table and it works fine in FF, IE6, Opera and Safari:
<div style="float:left; height:50%; margin-bottom:-250px;"></div
<div id="div" style="position:relative;l
<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td valign="middle"> <img src="images/logo.png" alt="logo" name="image" id="image" /> </td></tr></table> </div>
Hi abemiester, I'm glad my solution helped. I wonder why the B grade? If you needed any additional help I would have been happy to give you additional assistance.
About grading and the opportunity to answer your needs: http://www.experts-exchang
You can change the grade by clicking the "request attention" button: http://www.experts-exchang
Business Accounts
Answer for Membership
by: JagarmPosted on 2009-06-30 at 14:47:03ID: 24749948
use:
vertical-align:middle;