Current location: Hot Scripts Forums » General Web Coding » CSS » This is driving me nuts: div appearing outside other div


This is driving me nuts: div appearing outside other div

Reply
  #1 (permalink)  
Old 10-26-09, 06:59 PM
nbaumann00 nbaumann00 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
This is driving me nuts: div appearing outside other div

If you look here you will see that the red boxes are appearing outside the white area and over the footer. I'm not able to get those in the white content area, it's become very annoying.

Below is my code:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8" />
<title>Scenes | <?php echo $title; ?></title>
<link rel="stylesheet" href="template/style.css" type="text/css"/>
</head>
<body>
<div id="mainContainer">
    <div id="mainHeader">Header</div>
    <div id="topNav">top nav</div>
    <div id="content">
        <div id=catList>
            <div class="catBox">dfs</div>
            <div class="catBox">dfs</div>
            <div class="catBox">dfs</div>
       </div>
    </div>
    <div id="footer">footer</div>
</div>
</body>
</html>
HTML Code:
body {
	margin-top: 0px;
	background-color: #B1946C;
}

#mainContainer {
	width: 750px;
	margin: 0 auto;
}

#mainHeader {
	background-color: #FF0;
	min-height: 91px;
}

#topNav {
	min-height: 30px;
	color: #ffffff;
	background-color: #000;
}

#content {
	background-color: #FFF;
}

#catList {
	width: 710px;
}

#catList .catBox {
	float: left;
	width: 170px;
	background-color: #F00;
	min-height: 180px;
	margin-left: 10px;
}

#footer {
	width: 100%;
	min-width: 750px;
	background-color:#0F6;
}

What am I doing wrong? Help is much appreciated!

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-27-09, 02:58 AM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
#catList .catBox {
float: left;
width: 170px;
background-color: #F00;
min-height: 180px;
margin-left: 10px;
}


A container will not expand if it has a floating DIV in it. Remove the Float element.
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-27-09, 10:49 AM
nbaumann00 nbaumann00 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Ok I tried that and now at least it expands but the catBox divs appear under each other and not left to right.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-27-09, 01:46 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Is absolute positioning an option?
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-27-09, 02:39 PM
nbaumann00 nbaumann00 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Well essentially every red box is going to be an image category of a gallery read from a database, so there could be 0 to many red boxes and they should appear on a new line for every 4th category.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-27-09, 03:42 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Should have double quotes (no functional impact):

<div id="catList">

Try changing:

#catList .catBox {

to

.catBox {

and I think you need the float.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 10-27-09, 05:10 PM
nbaumann00 nbaumann00 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Having the float makes it so each new div with that class appears on the right of the previous. Wirehopper, the changes you suggested get me back to my original issue.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 10-27-09, 06:41 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Dont even use a div then ... use a table. For the red boxes that is.
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 10-27-09, 07:06 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
?

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8" />
<style type="text/css">
body {
	margin-top: 0px;
	background-color: #B1946C;
}

#mainContainer {
	width: 750px;
	margin: 0 auto;
}

#mainHeader {
	background-color: #FF0;
	min-height: 91px;
}

#topNav {
	min-height: 30px;
	color: #ffffff;
	background-color: #000;
}

#content {
	background-color: #FFF;
	height: 700px;
}

#catList {
	width: 710px;
}

.catBox {
	float: left;
	width: 170px;
	background-color: #F00;
	min-height: 180px;
	margin: 10px;
}

#footer {
	width: 100%;
	min-width: 750px;
	background-color:#0F6;
}
</style>
</head>
<body>
<div id="mainContainer">
    <div id="mainHeader">Header</div>
    <div id="topNav">top nav</div>
    <div id="content">
        <div id=catList>
            <div class="catBox">cat 1</div>
            <div class="catBox">cat 2</div>
            <div class="catBox">cat 3</div>
	    <div class="catBox">cat 4</div>
	    <div class="catBox">cat 5</div>
	    <div class="catBox">cat 6</div>
       </div>
    </div>
    <div id="footer">footer</div>
</div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 10-27-09, 08:01 PM
nbaumann00 nbaumann00 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Thanks but this does not fix the problem. Remember, the amount of red boxes depends on the amount of categories. Scroll down here. This is what happens.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Above Form xavier039 CSS 1 07-13-09 11:52 PM
Image save driving me nuts! herghost PHP 10 05-08-09 05:11 PM
div css theighost CSS 11 09-14-08 03:30 AM
simple css driving me nuts bitstomper CSS 3 05-25-07 11:28 PM
Can't Understand java script maverickminds JavaScript 1 07-16-06 02:23 PM


All times are GMT -5. The time now is 01:38 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.