[HELP]How to add a background

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
You could do it through your style.css file. (If you have one)
 
Last edited:

Dub_Dude

Member
Messages
344
Reaction score
0
Points
16
for CSS: background-image: url("route/to/image")

for html: <body background="route/to/image">
 

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
HTML:
<style type="text/css">
body{
background-image: url("url/to/image");
background-repeat: none; /* Important so that background doesnt repeat itself */
}
</style>
 
Last edited by a moderator:

unpixelatedgamers

New Member
Messages
674
Reaction score
0
Points
0
There are a few ways to do it (as with all programming).

From your code it looks like you've already tried to do it here:
HTML:
</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a7fb3e9d' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:1&amp;n=a7fb3e9d' border='0' alt=''></a></noscript></center>
<STYLE TYPE="text/css">p {align=justify}
BODY{cursor: url(http://www.geocities.com/ang3lbabi3_x3/derek.ani);}
a {cursor: url(http://www.geocities.com/ang3lbabi3_x3/derek.ani);}
BODY BACKGROUND="http://www.collide.elementfx.com/bakground.PNG"
</STYLE>
<title>Welcome to Derek's Site!</title>
But your style is outside your "head" tags. So with most browsers it won't work, or it will act funky.

You've also seem to have two title tags, and your <html> tag is well below the start of your code. It should be almost right at the top. Only usually preceded by a doctype declaration.

First Method

That bit should look something like this:
HTML:
<head>
  <title>Welcome to Derek's Site!</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<STYLE TYPE="text/css">
body {
background-image:bakground.PNG;
background-repeat:no-repeat;
}
</style>
</head>

Second Method

Alternately, you can just add a background attribute to your body tag.
So, this:
HTML:
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (enter.png) -->

Would become this:
HTML:
</head>
<body background="bakground.PNG" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (enter.png) -->

Third Method

One final way to do it (that I know of) is to use an external stylesheet.
Add this inside your head tags:
HTML:
<link rel="stylesheet" href="mainstyle.css" type="text/css" />

Then create a file in your main directory with whatever filename you put inside the "href." In this case "mainstyle.css." Then add the following code to it:
HTML:
/* CSS Document */
body {
background-image:bakground.PNG;
background-repeat:no-repeat;
}

This is essentially the same as the first method, but instead of doing it inside the document, it farms out the work to a separate file. Which means you can use the same stylesheet across many pages. Without having to retype the whole code all the time.

Now, 3 ways to do it. Which one to choose?

Oh, sorry for snooping your code, if your worried about that sort of thing.
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
Perfect the
</head>
<body background="bakground.PNG" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (enter.png) -->

Worked Perfectly..
 

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
Code:
/* CSS Document */
body {
background-image: [B]url([/B]background.PNG);
background-repeat:no-repeat;
}

You forgot to add the url(background.png) to the code.
 
Last edited:
Top