CSS Background Images

body {
background: white url(images/bg.gif) no-repeat top right;
}

This amalgamates these properties:

* background-color, which we have come across before.
* background-image, which is the location of the image itself.
* background-repeat, which is how the image repeats itself. This can be repeat (equivalent to a ’tile’ effect across the whole background), repeat-y (repeating on the ‘y-axis’, above and below), repeat-x (repeating on the ‘x-axis’, side-by-side) or no-repeat (which shows just one instance of the image).
* background-position, which can be top, center, bottom, left, right or any sensible combination, such as above.

Advertisements

Posted on March 20, 2009, in CSS and tagged . Bookmark the permalink. 2 Comments.

  1. Try to use WordPress

    body { font-size: x-small; }

    when writing code, it looks very nice.

    Also instead of top right I would suggest top center for no other reason other then that it will degrade well when the screen is shrunk, by keeping your name which is usually in the center still visible.

    Also you can place units instead of top left right center.

    etc

  2. ^ How interesting, I did not figure it worked in comment boxes, sorry about that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: