Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    91
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Divs problem, can't use float, or can I?

    I'm trying to sit two divs next to each other, but I can't float one because then my background in my main div will not move down with the content...I think this is better shown:

    Code:
    <div id="wrapper">
      <div id="container">
      	<div id="header">
    			<div id="logo_float">
    				<?php
    					if ($logo) {
    						print '<img src="'. check_url($logo) . '" alt="'. $site_title .'" id="logo" />';
    					}
    				?>
    			</div>
    			<?php print $top_bar_links; ?>
      	</div>
      	<div id="body">
      		<div class="top_left_round"><div class="top_right_round"></div></div>
    			<div id="main">
    				<div id="left">
    					<?php if ($tabs) { print $tabs; } ?>
    					<?php if (isset($tabs2)): print $tabs2; endif; ?>
    
              <?php if ($help): print $help; endif; ?>
              <?php if ($messages): print $messages; endif; ?>
              <?php print $content; ?>
    				</div>
    				<div id="right">afasfsd
    				</div>
    			</div>
    			<div class="bottom_left_round"><div class="bottom_right_round"></div></div>
      	</div>
      </div>
    </div>
    and the css:

    Code:
    #body {
    	background: #fff;
    	width: 1000px;
    	position: relative;
    }
    
    #body .top_left_round {
    	background: transparent url(images/bodytopleft.png) no-repeat;
    	position: relative;
    	width: 8px;
    	height: 8px;
    }
    
    #body .top_left_round .top_right_round {
    	background: transparent url(images/bodytopright.png) no-repeat;
    	position: relative;
    	left: 992px;
    	width: 8px;
    	height: 8px;
    }
    
    #body .bottom_left_round {
    	background: transparent url(images/bodybottomleft.png) no-repeat;
    	position: relative;
    	width: 8px;
    	height: 8px;
    }
    
    #body .bottom_left_round .bottom_right_round {
    	background: transparent url(images/bodybottomright.png) no-repeat;
    	position: relative;
    	left: 992px;
    	width: 8px;
    	height: 8px;
    }
    
    #body #main {
    	position: relative;
    	padding-left: 10px;
    	padding-right: 10px;
    	height: 100%;
    }
    
    #body #main #left {
    	position: relative;
    	height: 100%;
    	width: 600px;
    }
    
    #body #main #right {
    	position: relative;
    	height: 100%;
    }
    Any help would be greatly appreciated! I'm trying to set the two divs next to each other.

    Thanks,

    Smeshy

  • #2
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts
    No, actually, it is better shown as a link to a site on the web.

    You have no Doctype there, and are missing the Head tags, and body tags, too, etc., etc.

    What's all that php do? Anything in it we might want to know about?

    Floats are used all the time to position div's. And clearing them is required.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •