views:

36

answers:

3

Hi All, I am having an issue with a layout i am trying to develop. I basically have split the view-port into 2 equal width divs with a different background tiled image in each.

i have it stretching full screen 100%, but have a problem on scrolling.

The background image is cropped to the original height of the view-port..!

Here's the html:

<body>

<div id="container">

        <div id="left" class="half">
        left content here
        </div>

        <div id="right" class="half">
            right content here
        </div>
</div>

</body>

Here's the css:

html, body {
    margin:0;
    padding:0;
    height:100%;
    font: 14px Gotham, "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
    color: #505050;
}

div#container {
    height: 100%;
    min-width: 800px;
    min-height: 500px;
}

div.half {
    height: 100%;
    width: 50%;
}

div.half#left {
    float: left;
    text-shadow: 0px 1px 1px white;
    background-image: url(images/metalBG.jpg);
}

div.half#right {
    float: right;
    text-shadow: 0px -1px 1px black;
    background-image: url(images/fabricBG.jpg);
}

Im wondering if the is maybe a javascript, hence included in this cat also.

A: 

I would use Firebug or similar to verify that it's a background problem, not a DIV sizing problem. Maybe what's clipped is not your BG image, but rather the height of your DIVs.

If this is not the case, you can try adding

background-repeat:repeat,

to your CSS for div.half, but this is already the default value, so unless you have some CSS somewhere overriding it, should be in place anyway.

levik
A: 

This seems to get me the result i want, not tested in explorer yet though.

html {
    margin:0;
    padding:0;
    font: 14px Gotham, "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
    color: #505050;
    background-image: url(images/metalBG.jpg);
}

body {
    float:right;
    margin:0;
    padding:0;
    width:50%;
    background-image: url(images/fabricBG.jpg);
}

#left {
    float:left;
    margin-left:-600px;
    width:550px;
}
Doobox
changing the width and position of the body is an interesting approach I haven't seen before :) Just be careful about the window size; given that your margin looks like its using pixels (though that could be what you're looking for)?
cm2
A: 

I haven't run this code but adding it to the existing code should work (I hope :P). You can keep the divs and their backgrounds fixed where they are using something like:

 .half{
    position:fixed; /* keeps the divs in the same place */
    overflow:auto;  /* overflowing content will scroll */
    background-attachment:fixed; /* the background won't scroll with content */
 }
cm2