the sun's not yellow it is chicken

The Case Of The CSS Background Image

So Roberto redesigns his blog but mentions in his comments he can’t figure out how to give the page a background image. Pero es facil — a bit of CSS to the rescue! The rule itself looks something like this (mind the wrap):


body {
background: #000 url(http://example.com/images/background.gif) top left no-repeat;
}

Add the above code to your stylesheet and it will position your background image, guess what, top left of the page, and that’s it. Probably not what you want, no? How about a horizontal repeat? Just replace “no-repeat” with “repeat-x”. Vertical repeat: “repeat-y”. Repeat all over the page: just get rid of “top left no-repeat” altogether. Note that an absolute url is used to point to the image (as opposed to just “images/background.gif”). It assures that the image will be found no matter the subdirectory in which your stylesheet is located.

Now, having never used blogspot, I’m not sure if you can host images there, so I will leave that for you to find out…

4 Comments

  1. Roberto

    You are very kind. I tried it and it worked, but the choice of fotograph was not the best. I’ll have to make sure I know what I want.
    Thanks.

  2. moonbug

    Roberto: have a look at these background patterns — I’m pretty sure there’s something to your liking.

  3. Galo

    Jurgen, here you have my new list of heroes:

    1- Maradona
    2- Mama
    3- you

  4. moonbug

    W00t! Spaceba!

© 2024 moonbug.org

Theme by Anders NorenUp ↑