coldkill Posted July 24, 2008 Share Posted July 24, 2008 Hey folks, another problem has come up with a new site I'm developing. I'm trying to get two divs to be in line with each other, I've tried using display: inline; to no avail, in fact it came up with a lot of errors in both IE and FX. Any ideas what I can do? Cold Quote Link to comment Share on other sites More sharing options...
PHPQuack Posted July 24, 2008 Share Posted July 24, 2008 Is this what you're trying to do, e.g. <div id="a"> Div A </div> <div id="b"> Div b </div> #a, #b { display: inline; } Quote Link to comment Share on other sites More sharing options...
PHPQuack Posted July 24, 2008 Share Posted July 24, 2008 If using inline, it's very similar to using inline for list items with DIVs instead, and you will have to use margin or padding to space them out. Maybe instead float the first div left and specify width for both DIVs. Depends on what you're trying to do. Quote Link to comment Share on other sites More sharing options...
coldkill Posted July 24, 2008 Author Share Posted July 24, 2008 Yes that was what I was trying to do. I did try float, the only problem is the background which is another Div, doesn't like this and doesn't think anything exists there as a result. Quote Link to comment Share on other sites More sharing options...
haku Posted July 24, 2008 Share Posted July 24, 2008 Without code or preferably a link, we can't give you a proper answer. Quote Link to comment Share on other sites More sharing options...
gijew Posted July 24, 2008 Share Posted July 24, 2008 When I try to make two divs inline I do something like this (not tested). The basics are I set the width for both divs. I float the left (or right) div and use clear:both afterwards so nothing gets caught in the float. Works perfect everytime (with a bit o' tweaking of course). <style type="text/css"> #a { float:left; width:200px; background:green; } #b { width:200px; background:red; } .clear { clear:both; } </style> <html> <div id="a">left content</div> <div id="b">right content</div> <div class="clear"></div> </html> Quote Link to comment Share on other sites More sharing options...
coldkill Posted July 24, 2008 Author Share Posted July 24, 2008 Ok, here's the code that is applicable: <div id="content_wrap"> <div id="providers"> <div class="header">Powered By</div> Images here </div> <div id="content"> Stuff here </div> </div> #content_wrap { width: 900px; padding: 10px 0px 10px 0px; } #content { width: 740px; margin-left: 140px; border: 1px solid #CCCCCC; padding: 0px 10px 0px 10px; } .header { padding: 2px 0px 2px 0px; background-image: url(images/header_background.jpg); background-repeat: repeat-x; color: #FFFFFF; font-weight: bold; text-align: center; } /* * Providers */ #providers { width: 120px; border: 1px solid #CCCCCC; } 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.