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 thoughts on “The Case Of The CSS Background Image

  1. 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.

Comments are closed.