1,105,331 Community Members

Srolling content

Member Avatar
XinJiki
Newbie Poster
11 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am trying to write CSS code that will give me a fixed background and scrolling content. I need the content to be contained with it own separate back ground that scrolls with it. If someone could point me in the right direction so I can learn how to do this I would be highly appreciative. Thanks

Member Avatar
hericles
Veteran Poster
1,078 posts since Nov 2007
Reputation Points: 98 [?]
Q&As Helped to Solve: 232 [?]
Skill Endorsements: 14 [?]
Featured
 
1
 

Its been a while since I've done that but the CSS should be:
background-attachment: fixed

Member Avatar
lps
Posting Whiz in Training
208 posts since Jul 2011
Reputation Points: 3 [?]
Q&As Helped to Solve: 43 [?]
Skill Endorsements: 2 [?]
 
0
 

sorry, wrong post...please ignore me or delete my post

Member Avatar
dantinkakkar
Junior Poster
174 posts since Aug 2011
Reputation Points: 19 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 4 [?]
 
0
 

You're looking at the overflow property. Set the overflow property to scroll .

overflow: scroll

This will make your element boxes scrollable, and attach a background using the background attribute.

Member Avatar
weekendrockstar
Junior Poster in Training
71 posts since Dec 2010
Reputation Points: 12 [?]
Q&As Helped to Solve: 16 [?]
Skill Endorsements: 0 [?]
 
0
 

Yes, both are correct and it just depends on which method you are aiming for. Normally a browser will repeat a background image by default when the text flows beyond the browser's screen height unless the attached argument is set to fixed then the text will be moved by the browser's side scroll bar but the image will not move to compensate which makes the text seem to float over it. But this affects the entire browser screen.

Since it seems that you are trying to scroll only a certain segment then you should use both. Assuming that you would want to use a DIV as the 'container' you should create a CSS class for it which sets the overflow to scroll and specify the background image and have it "fixed" as well.

This way your whole site won't have a fixed background if not necessary but the content box will look how you want it to.

Member Avatar
XinJiki
Newbie Poster
11 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks a lot. I will give this a try.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article