1 reply [Last post]
Knyn
Knyn's picture
User offline. Last seen 1 year 21 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-09-08
Posts: 1
Points: 2

Hello everyone,
I just created an account on this forum because I have a layout problem. I hope you have some suggestions how to solve it.
On the end of this post you can find a simplified version of the website I'm working on. The thing that I want to change, is that the background picture (or in this case color) of the yellow field (div id="c") is shifted 100 px down. So the yellow field should 'start' 100 px lower... As you can see in the code I tried to manage this with the background position statement but this doesn't seem to work..
Do you have any suggestions on what might work?
Thanks in advance!
Best regards,
Knyn

Code:

<html>
<head>
<style type="text/css">
body {text-align = center;}
 
#container{
position:relative;
width = 600px;
height = auto;
background-color=black;
}
 
#header{
background-color= red;
width = 600px;
height = 200px;
}
 
#menu{
width = 145;
float:left;
background-color= lime;
height = auto;
}
 
 
#rechts{
float:right;
background-color= brown;
width = 450;}
}
 
#c {
float: left;
background-color= yellow;
background-image:url('bg_c.jpg');
/*background-position ypos:100px;*/
width = 295;
heigth = auto;
z-index:99;}
 
#d {
float: right;
background-color= blue;
width = 145;
height = 400;}
 
#footer{
float: left;
background-color= purple;
width = 295;
}
 
#subcontainer{
position = absolute;
width = 600px;
heigth = auto;	
top = 150px;
left = 0px;
background-color =peru;
}
 
</style>
</head>
 
 
 
<body>
<div id="container">
 
<div id="header"></div>
 
<div id="subcontainer">
 
<div id="menu">
home<br>
page 1<br>
page 2</div>
 
<div id="rechts">
 
<div id="c">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. 
 
Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. 
 
</div>
 
<div id="d"></div>
 
<div id="footer"></div>
 
</div><!-- sluiten rechts -->
</div><!-- sluiten subcontainer -->
</div><!-- sluiten container -->
 
</body>
 
</html>

Tony
Tony's picture
User offline. Last seen 3 hours 5 min ago. Offline
rank Moderator
Moderator
Timezone: GMT+10
Joined: 2003-03-12
Posts: 3705
Points: 1115

Hi Knyn, Welcome to the

Hi Knyn,
Welcome to the forums.
The first thing I notice in your css is that you used = instead of :

Quote:

body {text-align = center;}

#container{
position:relative;
width = 600px;
height = auto;
background-color=black;
}

Should be:

body {text-align:center;}
 
#container{
position:relative;
width:600px;
height:auto;
background-color:black;
}

To push your yellow box down you should be able to use margin.

#c {
float: left;
background-color: yellow;
background-image:url('bg_c.jpg');
width:295;
heigth:auto;
z-index:99;
margin-top:100px;
}

You can also position background images within their container if need be.

Your question may have already been answered, search and read before you ask.