Add to Technorati Favorites

Microstock Button - all microstocks in one button

Archives

Categories

Buy Stock Photos for $1

View My Portfolio

Visit Stockxpert

Royalty Free Images

Royalty Free Images


Background images, margins and padding

Insert­ing a back­ground image on your page can be done in many dif­fer­ent ways. You can insert an image in the body tag or in one of the div tags that rep­re­sent the lay­out of your page. More infor­ma­tion about insert­ing a back­ground image can be found on the htmldog.com website.

I wanted the pic­ture to the left of my blog title and descrip­tion so I inserted it as a back­ground for the header. My code for the header now looks like this:

#header{
height:339px;
width:100%;
background-color:#FAFFFF;
background:#FAFFFF
url(‘http://www.geocities.com/susieswe/blog2/background1.jpg’) left top no-repeat;

}

The height of the header is the same as the height of the pic­ture I used. I set the height of the header tag after I had decided which pic­ture to use and what size it should be.

To be able to use my own pic­ture I needed a host to store the pic­ture for me. I used my old Yahoo! Geoc­i­ties account. The eas­i­est way to get the URL right is to upload the pic­ture to your host, surf to the pic­ture and copy the URL from the address bar on your browser.

To be able to place the blog title and the descrip­tion, so that they don’t over­lap the image, I have to add a piece of code to the style sheet.

#blog-title {
color:#B5582C;
font-family:cursive, arial, sans-serif;
font-style:italic;
font-weight:bold;
font-size:4em;
mar­gin: 20px 20px 30px 220px;
}

#descrip­tion {
color:#695838;
font-style:italic;
font-weight:bold;
font-size: 1.5em;
mar­gin: 5px 20px 5px 220px;
}

Infor­ma­tion about mar­gins and padding can be found at htmldog.com. You can find infor­ma­tion about how to write shorter code on the page Short­hand Prop­er­ties.

You can find the xhtml file here and a test blog here.

Wel­come back! Nice to see you again, hope you enjoy your visit.

Related posts

2 comments to Background images, margins and padding

  1. Robbie
    February 6th, 2005 at 1:11 am

    I ran across your blog via BlogA­zoo. All I can say is “BLESS YOU!!!”

  2. Frank Strovel III
    February 6th, 2005 at 2:18 am

    Ditto! I found your blog a cou­ple weeks ago and have used it and am still using it to make changes to my site. Your exam­ples are clearer than the help files on Blogger.

    Imagine…a blog that is USEFUL! Thank you!