tags:

views:

26

answers:

1

I am working with a project and I have come across an obstacle and I cannot seem to fix this problem. (Haha, fix)

I have a page consistent of html, php's <?php include=""; ?>, javascript (and jQuery) and of course, some CSS. The problem is the CSS.

The front page has one background picture and the subpages has another background picture.

The subpages' picture should be positioned at "right top" and the front page picture should be positioned in a such way that the entire picture is shown.

It worked just fine when no background-attachment: was specified, but I have a subpage which has more text than the page can include. This, of course, makes the page scroll. I want the picture to not move (stay fixed), but when I add a "fixed" to my background: in the css, the picture goes nuts. This is the order, I put my stuff in background:

div#container {
    background: #ccffff url("billder/bckground.jpg") fixed no-repeat right top;
}

I thought that the problem would maybe be here, but I tried to seperate the tags, or whatever it's called in css, like this:

background-color: #ccffff;
background-image: url("billeder/bckground.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
background-position: right top;

Still not working (still going wild)

I build the page using this method to make a div have a min-height: in percentage. This is the main page of my project and this is the subpage with a lot of text. As you can see, the main page goes crazy and the subpage's background picture is not properly shown, you cannot see the entire picture. The picture is fixed but not displayed the way I want it to.

I really hope you can help me, as I've put a lot of efford into this website.

Just to avoid any misunderstandings and annoying questions, I am not a very experienced programmer/web developer.

EDIT

To make things clear, what I want is for the background to stay fixed (scroll along with the page)

+1  A: 

Remove fixed and set min-height (or height which I think looks better) to 750px on your <div id="container_front">...</div>.

So it becomes this in your css:

div#container {
    position:relative;
    margin:0 auto;
    width:900px;
    background-color: #ccffff;
    background-image: url("billeder/bckground.jpg");
    background-repeat: no-repeat;
    background-position: right top;
    background-attachment: fixed;
    height: 750px;
    min-height: 750px;
}
lasseespeholt
Works when fixed is not in the css-code (just like it did before), but then the picture is not fixed as I want it to be :) I want the picture to follow along with the page when you scroll down
Latze
and the reason I use min-height is, that height (in "real" browsers, which are not IE) does not allow the container to expand in size :)
Latze
I thought you wanted that - 2 sec then. You should know that the size of the background is not height enough for larger screens (such as mine)
lasseespeholt
Oh! I will fix that soon (haha, fix again) :)
Latze
Try what I have now - it looks great in Chrome (testing the others). Arrg... IE failed
lasseespeholt
hhm I will try. But actually, I thinks the site looks and feels better un-fixed.
lasseespeholt
Does not surprise me that IE fails :) IE is build to fail...
Latze
Something just crossed my mind... Could it be that when I add "fixed", the picture "breaks loose" of the #container and applies the position "right top" to the body?
Latze
This is what you want: http://stackoverflow.com/questions/2262565/css-fixed-size-div-fixed-vertical-position-and-centered-horizontally
lasseespeholt
Jeg takker for svarene :)
Latze
you're welcome (danish: det var så lidt) :-)
lasseespeholt