Stickybomb Posted March 16, 2007 Share Posted March 16, 2007 ok i have a liquid/fixed layout with header,footer and 2 columns. i am wanting to center a div inside of the right column, with no luck so far. This is the basic layout that i have. //CSS body { margin: 0; padding: 0; } #header { height: 100px; background-color: #000; } #nav { float: left; width: 180px; height: auto; background-color: #666; } #content { margin-left: 10px; margin-top: 10px; height: auto; background-color: #fff; } #footer { clear: both; height: 30px; background-color: #000; } //html <div id="header"></div> <div id="nav"></div> <div id="content"> <div id="box"> </div> <div id="footer"></div> any help would greatly be appriciated! thanks Quote Link to comment https://forums.phpfreaks.com/topic/43044-solved-centering-a-div-inside-another-div/ Share on other sites More sharing options...
cmgmyr Posted March 17, 2007 Share Posted March 17, 2007 Well the first thing that you need to do is close your content div like: <div id="header"></div> <div id="nav"></div> <div id="content"> <div id="box"> </div> </div> <div id="footer"></div> I'll assume that you are trying to center "box" right? If so you need to do this: #box{ width:200px; margin:0px auto; } and that should center it for you...you do need a width in there though. Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/43044-solved-centering-a-div-inside-another-div/#findComment-209426 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.