Jump to content

How do they do that ?


usawh

Recommended Posts

1) Background-image:url(background_image.jpg) no-repeat;

2) You can't. Well actually I suppose you could by moving the link to your stylesheet to the bottom of your page, but none of the styles would be loaded until that point, not just the background image. Or you could have the declarations for that one element is a separate stylesheet and put that after the element.

Link to comment
https://forums.phpfreaks.com/topic/106516-how-do-they-do-that/#findComment-546231
Share on other sites

Hi

 

Thanks for the code

<style type="text/css">

  body {

    background-attachment:fixed;

    background-image:url(background_image.jpg);

  }

</style>

 

I have 10 different images how do I get the background to rotate to a different image when someone go to a different page or refresh the browser ?

 

regards,

usawh

Link to comment
https://forums.phpfreaks.com/topic/106516-how-do-they-do-that/#findComment-549755
Share on other sites

Step 1) in your CSS, leave the generic part:

  body {
    background-attachment:fixed;
  }

you can specify a background-image in the above code, and it will be the default image if you don't specify an alternate

 

Step 2) on each page, modify your body tag to have some inline CSS:

<body style="background-image:url(bg_home.jpg);">

 

an alternate to step 2 (and my preferred method) is to use a class on each body tag that you want different. So, in your CSS:

body {
  background-attachment:fixed;
}
body.home {
  background-image:url(bg_home.jpg);
}
body.about {
  background-image:url(bg_about.jpg);
}

 

then on your pages, use the class you want:

<body class="about">

Link to comment
https://forums.phpfreaks.com/topic/106516-how-do-they-do-that/#findComment-550389
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.