Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Graphics, Flash and Multimedia _ Image Scrolling

Posted by: jon Oct 3 2006, 02:23 PM

Hello, i have just started HTML a week or two ago, and i was wondering what code i would need in order to make an image stay in the back of the page but moving up/down as you scroll so it stays in the middle of the screen, im sorrry if its not specific enough but its hard to explain. I would really appreciate some assitance for my small problem! Anything is much appreciated! ninja.gif

Posted by: pandy Oct 3 2006, 02:46 PM

Like a background? You can do that with CSS and 'background-attachment: fixed' + a little more.

This is probably a little hard to understand if you are new, but you can save it for later.
For CSS basics, read this.

You could use something like this in a style sheet (you can read at the second page I linked to how you can link a style sheet to your HTML).


body  { background-color: #abc123;
        background-image: url(DL/ab.jpg);
        background-attachment: fixed;
        background-position: center center }

background-image tells what image to use
background-attachment fixed means it won't scroll with the page
background-position lets you position the background image

It can be written shorter like this ('background' is shorthand for all background properties).
body  { background: #abc123 url(pic.jpg) no-repeat fixed center }

Posted by: jon Oct 3 2006, 05:32 PM

OMG thank you so much, now i can show my teacher in business class how to do this! Thanks very much for your assistance!

Posted by: pandy Oct 3 2006, 07:00 PM

BUSINESS class? IPB Image

You are welcome nevertheless. happy.gif

Posted by: jon Oct 4 2006, 12:26 PM

yeah im in highschool 10th grade business class about online business.. we use html to create our own website and as a final project we sell a product! its alot of fun! ninja.gif also i was wondering as a html tag how do you make a immage not repeat, do you have to use a style or can you just use a different tag?, the style worked great with our site thanks for the help...

Posted by: Frederiek Oct 4 2006, 12:51 PM

Since you're in school, I'll give you an url to find the reply by yourself

Posted by: pandy Oct 4 2006, 01:31 PM

No, HTML can't do that. HTML is for structure (headings, paragraphs, lists and so on), CSS for style. HTML eventually came to include quite a lot of page style elements, but it wasn't intended for this and was never very well suited for it, hence those tools are blunt. I.E. HTML can make a background image appear, but that's it. CSS can apply it to any element, not only body, and, as you've seen, it can do a lot more with it than just make it appear.

Use each language for what it's indtended for and don't let your teacher make you write FONT tags and such. tongue.gif

Posted by: jon Oct 4 2006, 02:04 PM

thanks again!

Powered by Invision Power Board (
© Invision Power Services (