I am trying to create a layout with a top menu bar area, and then a split 75 / 25 screen with a fixed and covering background.
--------------------------------------------------------
| |
--------------------------------------------------------
| | |
| | |
| | |
| | |
| | |
| | |
--------------------------------------------------------
The left hand main area should scroll in the y direction as per any normal page.
The top menu bar should scroll with the main content.
But the region on the right hand area needs to have a fixed background that scales and covers this entire region (using CSS cover property), and is fixed - so it doesnt scroll, always covers this area, and is always visible.
I can do parts of this but not everything at the same time!
I can get the 75/25 split, get the top bar and the split, or get a covering and fixed background, but cant get everything to work together!
Ignoring top bar, this code works for everything except the position of the rhs background. The backgrounds are in place and are fixed, and the rhs background scales and covers, but it is not in the correct position within the block:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
html {
height: 100%;
width: 100%;
}
body {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
}
.lhs {
width: 75%;
float: left;
background: url(lhs_bg.jpg) repeat left top;
}
.rhs {
width: 25%;
float: right;
background: url(rhs_bg_1.jpg) no-repeat left center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<div class="lhs">
lhs
<br /><br /><br /><br /><br /><br />1
<br /><br /><br /><br /><br /><br />2
<br /><br /><br /><br /><br /><br />3
<br /><br /><br /><br /><br /><br />4
<br /><br /><br /><br /><br /><br />5
<br /><br /><br /><br /><br /><br />6
<br /><br /><br /><br /><br /><br />7
<br /><br /><br /><br /><br /><br />8
<br /><br /><br /><br /><br /><br />9
<br /><br /><br /><br /><br /><br />10
<br /><br /><br /><br /><br /><br />11
</div>
<div class="rhs">
rhs
<br /><br /><br /><br /><br /><br />1
<br /><br /><br /><br /><br /><br />2
<br /><br /><br /><br /><br /><br />3
<br /><br /><br /><br /><br /><br />4
<br /><br /><br /><br /><br /><br />5
<br /><br /><br /><br /><br /><br />6
<br /><br /><br /><br /><br /><br />7
<br /><br /><br /><br /><br /><br />8
<br /><br /><br /><br /><br /><br />9
<br /><br /><br /><br /><br /><br />10
<br /><br /><br /><br /><br /><br />11
</div>
</body>
</html>
Numbers are just there to show the content scrolling as it should and make sure the page is taller than the browser to force it to scroll.
My guess is that the background image is still sizing to cover the full screen, not the parent div element of the right hand area only - so you only see part of the full image in the rhs area, not the full image.
Any tips?!