fortnox007 Posted December 8, 2010 Share Posted December 8, 2010 HI all, just a small question; mostly when I have a layout with floats I am using margin with literal pixels to put the floated div back in the center. The question is is there a smarter way? for instance: a wrapper div with 2 child div's. #wrapper{ width: 500px; margin: 0 auto; /*to center align it */ } #left{ /*this is inside wrapper */ width:200px; float: left; margin:25px /* 100/4=25 of wrapper */ } #right{ /*this is inside wrapper */ width:200px; float: left; margin: 25px } I tried margin: 0 auto; on the child div's but that didn't have any effect. If the above is the right way to go please let me know so I know I can stop worrying Quote Link to comment https://forums.phpfreaks.com/topic/220987-small-question-about-floating/ Share on other sites More sharing options...
haku Posted December 8, 2010 Share Posted December 8, 2010 What are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/220987-small-question-about-floating/#findComment-1144432 Share on other sites More sharing options...
fortnox007 Posted December 8, 2010 Author Share Posted December 8, 2010 Well i am trying to find out if the is the right way to center align a wrapper div of 500px, and within it it has 2 divs of each 200 px also center aligned (wh are floating). But i allready noticed that IE 6 is being a pain in the ass. but the fix they brought (display:inline) doesn't seem to work [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/220987-small-question-about-floating/#findComment-1144540 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.