- This topic is empty.
-
AuthorPosts
-
December 1, 2010 at 4:07 pm #30864
Kralle
ParticipantHello everyone!
I’m having a bit of a problem with an image which should repeat itself all the way down to the footer. I started using an image for the sidebar-div, the image stopped repeating itself down the y-axis when the content stopped. It’s a background for the sidebar.
The structure is as followed:
I tried assigning the image to the content-div, since it’s surrounding both the main-content and the sidebar via the following CSS-code:
#content {
width: 960px;
margin-top: 0px;
background: url(/images/sidebarbackground.png) right repeat-y;
}But nothing happens, sadly.
Does anyone have a solution to my problem?
Thanks in advance,
KralleDecember 1, 2010 at 10:34 pm #71468ozee
MemberDecember 2, 2010 at 1:33 pm #71313ozee
Memberthat’s very true too! Had you tried it with content in the div that you want the background to show up on?
December 2, 2010 at 3:50 pm #71321Kralle
ParticipantYes, I only posted the structure. Nothing happens with content in it – sadly. You can see a preview here:
December 2, 2010 at 6:55 pm #71330ozee
MemberI played with your code in firebug some and the best way I found to do what it sounds like you are wanting is to apply that
background: url(/images/sidebarbg.png) repeat-y;
to the id for the sidebar wrapper. Let me know if this helps you!
December 2, 2010 at 7:34 pm #71294Kralle
ParticipantIt works perfectly when I apply it to the #sidebar-wrapper, but I want it to be on #content, since a page like this page won’t allow the background to continue down to the footer. I tried applying overflow:auto to #content and the background to #sidebar-wrapper, and I got the same result.
I should have linked to this page in the first place, my bad. :-)
December 2, 2010 at 8:06 pm #71295ozee
MemberI was able to get this to work by using positioning and setting a top, a bottom and a left position to the sidebar since you have a fixed width on the content, this can work for you.
#content {
margin-top: 0px;
position: relative;
overflow: auto;
}#main-content {
width: 650px;
line-height: 15px;
font-size: 12px;
padding-bottom: 40px;
position: relative;
}#sidebar-wrapper {
background: url(/images/sidebarbg.png) repeat-y;
margin-top: 0px;
width: 300px;
position: absolute;
top: 0;
left: 650px;
bottom: 0;
}
December 3, 2010 at 8:00 pm #71037Kralle
ParticipantThanks a bunch for your help, ozee and virtual. It’s been a great help! I really appreciate all the contributions. :-) ended up using virtual’s correction.
May I ask why exactly 90% did it, and what did it exactly do?
December 3, 2010 at 8:20 pm #71042ozee
MemberI like virtual’s suggestion better than mine anyhow lol, I didn’t think of that. Correct me if I am wrong; but since there is an overflow: auto the image flowed down to the footer, the 90% allowed the image to align itself to the right without touching the right side of the div, hence moving the element 90% to the right.
December 3, 2010 at 10:29 pm #70995ozee
MemberThat makes a lot more sense that my method of moving it based on using position and coordinates, learn something new everyday I guess!
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.