Small problem with backgrounds

Reply

Join Date: Sep 2006
Posts: 5
Reputation: Lykil is an unknown quantity at this point 
Solved Threads: 0
Lykil Lykil is offline Offline
Newbie Poster

Small problem with backgrounds

 
0
  #1
Sep 1st, 2006
I'm not sure exactly how to search for a solution to this problem (unable to articulate it in googlable terms), so I'm posting here.

It should be very simple, all I need to do is start my background with one picture, and then continue the rest of the page with another. The aim is to get a gradually brighter background (first image) and then just a repeating pattern, with the same brightness (second image)

Any help would be appreciated!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Small problem with backgrounds

 
0
  #2
Sep 1st, 2006
You can only have one background, for any given element (such as the body itself). However, you can have an overall background color, with an image fixed at the top that fades into that color.

Have you seen something somewhere close to what you want? Give us a link, and we can likely break it down for you.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 5
Reputation: Lykil is an unknown quantity at this point 
Solved Threads: 0
Lykil Lykil is offline Offline
Newbie Poster

Re: Small problem with backgrounds

 
0
  #3
Sep 1st, 2006
Ok, here'sone of my favourite webpages:

www.backstreetboys.com

:o
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Small problem with backgrounds

 
0
  #4
Sep 1st, 2006
Ok, first, three images are used:

http://www.backstreetboys.com//images/bg-4.gif

That is the background image of the body element. So, the entire body of the page is set to that image. It obviously tiles.

Next, we have:

http://www.backstreetboys.com//images/bg-4-gradient.gif

This provides the "fade" effect, and is the background of a div element named "main". The "main" div comes right after/under the body, and everything else is inside of it. The style is set to repeat horizontally, but not vertically. Thus this image marches across the top of the page.

[html]
<html>
<head>
<style type="text/css">
body {
background-image:url(../images/bg-4.gif);
background-position:top center;
}
#main {
background-image:url(../images/bg-4-gradient.gif);
background-position:top center;
background-repeat:repeat-x;
}
#globalWrapper {
background-image:url(../images/shadow-4.gif);
background-position:top center;
background-repeat:no-repeat;
}
</style>
</head>
<body>
<div id="main">
<div id="globalWrapper">
</div>
</div>
<body>
</html>[/html]

Lastly we have the image for the globalWrapper, another div after/under "main". It's too big to place here, but it's basically a "frame" for the page content, and isn't necessary for achieving the background effect.

To summarize: set the background of the "body" tag to your overall repeating pattern. Then place a div just under the body, and set its background to an image that is "darker" at the top, but is an exact match for the overall pattern at the bottom. Set it to repeat horizontally at the top of the page.
Last edited by tgreer; Sep 1st, 2006 at 5:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 5
Reputation: Lykil is an unknown quantity at this point 
Solved Threads: 0
Lykil Lykil is offline Offline
Newbie Poster

Re: Small problem with backgrounds

 
0
  #5
Sep 2nd, 2006
thanks for the help. got the image loaded up, but div causes a line break before it renders the image. There doesn't seem to be any easy way around.

Wherever I've searched, it has been recommended to use

<div style="display: inline;">


but this just causes the image to disappear again.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Small problem with backgrounds

 
0
  #6
Sep 2nd, 2006
Using the images from the post below, this displayed nicely in IE and Firefox...

[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body {
background-image: url(bg-4.gif);
background-position:top center;
margin: 0px;
padding: 0px;
}
#main {
background-image: url(bg-4-gradient.gif);
background-position:top center;
background-repeat:repeat-x;
height:300px
}

</style>
</head>
<body>
<div id="main">
<div id="globalWrapper">stuff
</div>
</div>
</body>
</html>
[/html]
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 5
Reputation: Lykil is an unknown quantity at this point 
Solved Threads: 0
Lykil Lykil is offline Offline
Newbie Poster

Re: Small problem with backgrounds

 
0
  #7
Sep 2nd, 2006
That did the trick. Thanks a lot.

Think I learned something new in th process as well. It seems I had placed the "margin: 0px" within the wrong brackets when I tried it.

Btw, can this part of the code from the BSB webpage be viewed?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Small problem with backgrounds

 
0
  #8
Sep 2nd, 2006
Yep, you need to make sure to set the margin and padding of all block level elements to "0" if you want them to abut each other seamlessly.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC