Hey, I'm having alot of trouble with these divs. How do you align two divs right beside each other and center them inside another div? I got them right beside each other I just can't get them to center in the div. CSS Code: body{ background-color:#64a43e; font-family:tahoma; font-size:small; color:#ffffff; margin: 0px; } a:link,a:visited,a:active { text-decoration:none; color:#ffffff; } a:hover { color:#45702b; text-decoration:none; } .containertop { height: 11px; width: 781px; background: url('images/containertop.jpg') left top no-repeat; } .container { width: 781px; background: #7bb25b; } .containerbottom { height: 11px; width: 781px; background: url('images/containerbottom.jpg') left top no-repeat; } .searchtop { height: 12px; width: 607px; margin:0; padding:0; background: url('images/searchtop.jpg') left top no-repeat; } .search { height: 35px; width: 607px; margin:0; padding:0; background: #ffffff; } .searchbottom { height: 12px; width: 607px; margin:0; padding:0; background: url('images/searchbottom.jpg') left top no-repeat; } .searchbutton { height: 59px; width: 135px; float:right; margin:0; padding:0; } Code (markup): HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div align="center"> <div class="containertop"></div> <div class="container" align="center"> <div class="searchbutton"><img src="images/search.jpg" alt="" /></div> <div class="searchtop"></div> <div class="search"></div> <div class="searchbottom"></div> </div> <div class="containerbottom"></div> </div> </body> </html> Code (markup): Those are the codes i'm using could someone please help. Thank you
just put the two div's in a larger div, don't worry about them centering, worry about making the outer div auto-center left/right margin: auto position: relative