Quick Search
Sunbelthost Hosting - Colocation and Dedicated Servers

Threads: 21,763
Posts: 83,205
Members: 24,315
Newest member: joemccue

Web Hosting


 
  #1  
Old 12 Nov 2009, 10:27 PM
tribethrow tribethrow is offline
Established Member
 
Join Date: Oct 2009
Posts: 19
Span background image full width of site help

Hey all,

This is probably a pretty basic fix but here's what I want to do.

I'm trying to get a background on dynamic content (bg should only be behind said content).

So I'm just testing somethings out but I'd like to have the background image span the entire width of the site, but have the content centered (margin: 0 auto 0 auto) in a div on top.

Anyway to do this without absolute positioning? I want to have 3 or 4 situations like this (with different bg imgs) and I'm not too sure of using absolute positioning so I'd either like to avoid it, or learn it simply haha.

Here's what I have.

<div id="bluecontainer">
<div id="blue">
<jdoc:include type="component" />
</div>
</div>

CSS:

#bluecontainer {
background-image: url(../images/bluebg.png);
z-index: -2;
}

#blue {
padding: 0 50px 0 50px;
width: 980px;
margin: 0 auto 0 auto;
}

Thanks for any help!!

Alex
Reply With Quote
  #2  
Old 13 Nov 2009, 01:07 AM
Wickham's Avatar
Wickham Wickham is offline
Established Member
 
Join Date: Feb 2006
Location: Salisbury UK
Posts: 3,865
You can't make a background-image stretch to any window resolution so you have to use a normal image. You can do this by using position: absolute or position: fixed and make sure it is behind other content by using z-index: -1;

Here's an example using position: fixed;
http://www.wickham43.net/backgroundf...hflexible.html
__________________
Code downloaded to my PC will be deleted in due course.
WIN XP SP3; IE7, Firefox 3.5, Opera and Safari for Windows; screen resolution usually 1024x768.
IE6 on W98 with 800*600. IE8 RTM on Vista 1440*900.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
hotspotting a background image calskin Web Design, HTML Reference and CSS 5 03 Nov 2009 05:31 PM
Help with Spry dropdown menu stevepugh Web Design, HTML Reference and CSS 2 27 Nov 2008 01:37 PM
Trouble with <ul> menu. oesj2 Web Design, HTML Reference and CSS 5 27 Apr 2008 12:10 PM
css background image alignment only works for IE pokinski Web Design, HTML Reference and CSS 1 06 Feb 2007 08:24 AM


All times are GMT -5. The time now is 01:24 PM.


 

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Forums Copyright © 2004-2010, WebDevForums.com. Web design by Miami Web Design. All Rights Reserved.