Trium918 Posted May 26, 2007 Share Posted May 26, 2007 I am trying to get an an image to center with a <div> tag. The image is attached below. Here is the entire code! <style type="text/css"> HTML #member { HEIGHT: 1% } #member{ background-color:#f7f7f7; display:block; width:530px; border-bottom: #0273AD 1px solid; border-left: #0273AD 1px solid; border-right: #0273AD 1px solid; border-top: #0273AD 1px solid; padding: 5px; } #member_content{ background-color:#000000; width: 362px; float:right; } #member_image{ background-color:#000000; width: 160px; height: 150px; float:left; VERTICAL-ALIGN: top; TEXT-ALIGN: left } </style> [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted May 27, 2007 Share Posted May 27, 2007 First, "VERTICAL-ALIGN: top;" is not a valid css command. Second, where are you trying to center the image? In "#member" or in "#member_content? If within #member_content try this: #member_content{ background-color:#000000; width: 362px; float:right; #member_content img { width: 160px; height: 150px; margin-right: auto; margin-left: auto; } (or use the short-hand for the above 2 margin commands - margin: 0 auto;) Remember, the cascading order for padding, margin, is always "top, right, bottom, left". And your borders in #member, can simply be ... border: 1px solid #0273AD; Quote Link to comment Share on other sites More sharing options...
unidox Posted May 31, 2007 Share Posted May 31, 2007 Also, make sure spaces are where spaces are sposed to be. Your missing some and some are in the wrong place. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.