HTML Help Forum HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

centering my background
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum -> Images & Graphics
View previous topic :: View next topic  
Author Message
LTBro



Joined: 13 Sep 2005
Posts: 1

Posted: Tue Sep 13, 2005 10:07 pm     centering my background  

my picture for my background continues to tile and i want to center it how would i do that?


Corey Bryant



Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

Posted: Wed Sep 14, 2005 3:57 am      

You will need to use CSS. Place something like this in the <head>:
Code: <style type="text/css">
body
{
background-image: url('images/background.gif');
background-repeat:no-repeat;
background-position:  center;
}
</style>
deeply noted



Joined: 14 Sep 2005
Posts: 7
Location: So Cal

Posted: Thu Sep 15, 2005 5:27 pm      

Is there a way to keep the background image from moving while the page is being scrolled? Like you can do on myspace.
Corey Bryant



Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

Posted: Thu Sep 15, 2005 5:39 pm      

deeply noted wrote: Is there a way to keep the background image from moving while the page is being scrolled? Like you can do on myspace.
I am not familiar with myspace, but I am familiar with CSS properties for background images. You can try something like
Code: <style type="text/css">
body
{
background-image: url('images/background.gif');
background-repeat: no-repeat;
background-attachment: fixed;
}
</style>
deeply noted



Joined: 14 Sep 2005
Posts: 7
Location: So Cal

Posted: Thu Sep 15, 2005 6:17 pm      

Hi Corey, I appreciate your help. I've tried both codes that you have posted here. Unfortunately neither works the way I'd like it to.

There must be a way...
Corey Bryant



Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

Posted: Thu Sep 15, 2005 6:38 pm      

What DOCTYPE are you using?

In what way does it not work? The
Code: background-attachment: fixed;
will keep the background image fixed. You are placing the CSS code in the <head> of the HTML document as well?
deeply noted



Joined: 14 Sep 2005
Posts: 7
Location: So Cal

Posted: Thu Sep 15, 2005 8:02 pm      

It looks like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Joey's Bass Notes - Links</title><style type="text/css">
body
{
background-image: url("tn%27s/Aug73_4001.JPG");
background-repeat:no-repeat;
background-position: fixed;
}
</style>
deeply noted



Joined: 14 Sep 2005
Posts: 7
Location: So Cal

Posted: Thu Sep 15, 2005 8:06 pm      

Hey, I just caught my mistake!

I changed "postion" to "attachment:.

Many thanks Corey!! :D
Corey Bryant



Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

Posted: Thu Sep 15, 2005 8:34 pm      

Glad it is working out for you now
 
 
DARFUR
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum -> Images & Graphics
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group