ukscotth Posted October 31, 2011 Share Posted October 31, 2011 Hi all, Im new to css and im having a problem. The content i place in the left and right divs is appearing under the main div. Can anyone see what Im doing wrong ? #win_body { border: 1px solid #BDC7D8; } #win_half_left { float:left; } #win_half_right { float:right; } #clearfix{ clear:both; } Many thanks, Scott Quote Link to comment https://forums.phpfreaks.com/topic/250187-content-appearing-under-main-div-problem/ Share on other sites More sharing options...
floridaflatlander Posted October 31, 2011 Share Posted October 31, 2011 It can depend on the order of your divs in the file, also how wide are your divs, do they it have margins, padding, also are any closing tags missing? Quote Link to comment https://forums.phpfreaks.com/topic/250187-content-appearing-under-main-div-problem/#findComment-1283811 Share on other sites More sharing options...
ukscotth Posted October 31, 2011 Author Share Posted October 31, 2011 Hi, I've tried it with different widths, margings and paddings and the content still appears underneath for some reason. Yep checked to make sure all the tags are closed. it does it even when I use this : <div id = "win_body"> <div id ="win_half_left"> test content </div> <div id ="win_half_right"> test content </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/250187-content-appearing-under-main-div-problem/#findComment-1283819 Share on other sites More sharing options...
floridaflatlander Posted November 1, 2011 Share Posted November 1, 2011 How can the content appear under the main div when the left & right columns are included in the main div? (talking joe average css of course, none of the float or neg margin stuff) When I have problems sometimes I add color and/or borders to get a better feel of the lay out. Try this #win_body { border: 1px solid #BDC7D8; height: 500px; width: 500px; background-color: #eeeeee; margin: 0 auto; } #win_half_left {float:left; background-color: red;} #win_half_right {float:right; background-color: yellow;} #clearfix{ clear:both;} Then take out the height to see what happens. Then take out the width to see what happens. Then float the main div to the left and see what happens. This happens all the time, you can cure it by adding another div to contain your left and right columns and float it or you can add a brake under the the left and right divs but before the closing main div like I do sometimes like this <br class="clear" /> and style it .clear{clear: both;} The only problem with the last one is that it adds height that you may not want to be there. Quote Link to comment https://forums.phpfreaks.com/topic/250187-content-appearing-under-main-div-problem/#findComment-1283945 Share on other sites More sharing options...
floridaflatlander Posted November 5, 2011 Share Posted November 5, 2011 Did you get it figured out? Quote Link to comment https://forums.phpfreaks.com/topic/250187-content-appearing-under-main-div-problem/#findComment-1285209 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.