I'm Michael Suodenjoki - a software engineer living in Kgs. Lyngby, north of Copenhagen, Denmark. This is my personal site containing my blog, photos, articles and main interests.

Updated 2011.01.23 15:37 +0100

 

Stretched background image in your MySpace profile

Many people spends a lot of time customizing their MySpace profile. It can be a lot of fun. One of the recurring frequently asked questions is how to achieve a stretched background image on the profile. I've investigated this a bit and found a few solutions. None of them are unfortunately fully perfect, but they may perfect enough for you.

Note that the stretched background problem is not restricted to MySpace pages. It is a general problem for all web pages. There are no really good solution to this today (Spring 2009). We'll have to wait for CSS3 background-size property support. If you are yourself in full control of the webpage (which you aren't in MySpace profiles), then there are workarounds, see e.g. About.com.

All the following how to descriptions is assuming that you're using MySpace Profile 2.0.

Solution 1: Use a large background image

Use a background image which is large enough to fill up the entire background on most monitors.

Advantages

Disadvantages

How to

  1. Upload a large enough background image (e.g. 1920x1200) on a image hosting site where large images is allowed.
  2. In your MySpace profile activate the Profile > Customize Profile.
  3. Activate Appearance > Advanced Edit > Background.
    • Enter the Url to the location of the hosted image, e.g. http://www.yoururl.com/images/myspacebg.jpg
    • Ensure that Scroll with page is set to No and
    •  Repeat is set to Do not repeat.
  4. Activate the Preview button to view the result. If satisfied activate the Publish button.

MySpace: Customize Profile with large background. Click for larger view.

Solution 2: Preliminary CSS3 support

Most browsers today (spring 2009) does not support the CSS3 background-size property. If they did all problems with stretched backgrounds would have been solved. However most browsers using the webkit engine does have preliminary support for the property. That covers e.g. the browsers Safari and Chrome.

Advantages

Disadvantages

How to

  1. In your MySpace profile activate the Profile > Customize Profile.
  2. Activate Appearance > CSS
  3. Enter the following CSS code - replace the url with the location of your image:
  4. body 
    { 
      background-image: 
    url(http://www.yoururl.com/images/myspacebg.jpg);
      x-webkit-background-size:100% 100%;
    }
  5. Activate the Preview button to view the result. If satisfied activate the Publish button.

MySpace: Customize Profile with CSS3 resized background. Click for larger view.

Solution 3: Inject Img element

The last solution, which again is not perfect, is about injecting an HTML Img element into your profile and then control its position on the page to fit the browser window.

Advantages

Disadvantages

How to

  1. In your MySpace profile activate Profile > Edit Profile
  2. On the Edit Profile page activate About Me.
  3. In the About Me section enter the following HTML codes to inject the Img element which refer to your background image. The src attribute should refer the the image.
<img id="back" width="100%"
     src="http://www.yoururl.com/images/myspacebg.jpg"/>
  1. Activate Save Changes button to save your changes.
  2. Activate Profile > Customize Profile
  3. Activate Appearance > CSS
  4. Enter (add) the following CSS code - which essentially will position the injected image (identified by id="back") to fit into background as stretched:
  5. #back
    {
      width: 100%;
      height: 100%;
      left: 0px;
      top: 0px;
      position: absolute;
      z-index: -1;
    } 
  6. Activate the Preview button to view the result. If satisfied activate the Publish button.