Reputation: 699
Currently I'm working with http://jsfiddle.net/ngZdg/
Ultimately, I'm trying to get a parallax website going, but i'm struggling with initial layout issues. I'm trying to get the following layout:
-------------------------------------
| |
| |
| ______ ______ |
| | | | |
| | | | |
| ______ ______ |
| | | |
| | | |
| ______ |
| |
-------------------------------------
Any suggestions?
Upvotes: 0
Views: 64
Reputation: 5785
I have updated the fiddle, with the background absolute,and other div are relative in positioning
Please refer link http://jsfiddle.net/MarmeeK/ngZdg/19/
the CSS is like this
@charset"utf-8";
#main {
background:pink;
width:1280px;
height:900px;
position:absolute;
top:0;
left:0;
bottom:0;
margin:0;
padding:0;
}
#chapter1 {
margin:100px auto 100px auto;
background: blue;
height:500px;
width:800px;
padding:100px;
}
#chapter1_1, #chapter1_2, #chapter1_3 {
width:200px;
height:200px;
position:relative;
display:block;
margin:0;
padding:0;
float:left;
}
#chapter1_1 {
background-color:red;
left:100px;
}
#chapter1_2 {
background-color:yellow;
left:100px;
}
#chapter1_3 {
clear:both;// to clear the float to next line.
background-color:green;
left:300px;
}
I am sure this will do. :)
Upvotes: 0
Reputation: 7190
The way you closed your divs was not closing them in the fiddle. This creates something similar to your diagram.
<div id="main">
<div id="chapter1">
<div id="chapter1_1"></div>
<div id="chapter1_2"></div>
<div id="chapter1_3"></div>
</div>
</div>
CSS:
html, body {
height:100%;
width:100%;
margin:0;
padding:0;
}
#main {
background-color:#00FF00;
width:100%;
height:100%;
/*position:absolute;
left:50%;
margin-left:-640px;*/
}
#chapter1 {
background: blue;
height:100%;
position:relative;
width:100%
}
#chapter1_1,
#chapter1_2,
#chapter1_3 {
height:20%;
width:20%;
position:absolute;
}
#chapter1_1 {
background-color:red;
top:10%;
left:30%;
}
#chapter1_2 {
background-color:yellow;
left:50%;
top:10%;
}
#chapter1_3 {
background-color:green;
top:30%;
left:50%;
}
Upvotes: 1
Reputation: 3814
try this:
@charset"utf-8";
#main {
background-color:pink;
width:1280px;
height:100%;
position:absolute;
}
#chapter1 {
background: blue;
width:90%;
height:90%;
}
#chapter1_1 {
background-color:red;
width:100px;
height:100px;
left:100px;
top:50px;
position:absolute;
}
#chapter1_2 {
background-color:yellow;
width:100px;
height:100px;
left:205px;
top:50px;
position:absolute;
}
#chapter1_3 {
background-color:green;
width:100px;
height:100px;
top:155px;
left:205px;
position: absolute;
}
You also need to close your <DIV>
tags.
<div class="whatever" />
is not correct, it needs to be
<div class="whatever"></div>
Upvotes: 1