...

View Full Version : CSS Background problem. . .



Whiskeyeffect
12-22-2009, 05:57 PM
Hey guys, volunteered to design a website for a friend who's producing a movie. However, I'm having a few problems with the background.

I can't get the background to stretch with the rest of the page when it resizes. . .if the page is made smaller, and then scrolled over (like users with smaller resolutions might do) the background and top header disappear, and nothing is readable. What am I doing wrong here? Please let me know. The web address is

http://www.radiointifadathemovie.com

I'm about to scrap this layout because of this. . .maybe you all may know what I'm doing wrong here.

and here's the css. ..


//

html, body {

margin: 0;
padding: 0;

}


body {

font-family: Georgia, "Times New Roman", Times, serif;
font-size: 14px;
color: #000000;

}

a:link {
color:#FFCC00;
font-weight: bold;
text-decoration: none;
}

a:active {
color: #FFCC00;
font-weight: bold;
text-decoration: none;

}

a:visited {
color: #FFCC00;
font-weight: bold;
text-decoration: none;
}

a:hover {
color: #FFCC00;
font-weight: bold;
text-decoration: underline;
}

h1 {

margin: 0px;
padding: 0px;

}

#contentleft .p {

text-indent: 20px;

}

img.priceposition {

position:relative;
left: 20px;

}

#page-container {

width: auto;
margin: auto;

}

#header {
width: 100%;
height: 100px;
background-color:#000000;

}

#contentmidcontainer {

width: 100%;
height: 500px;
margin: auto;
background-image:url(../images/centerbg.jpg);
background-repeat:no-repeat;

}

#contentmiddle {

width: 941px;
height: 500px;
margin: auto;

}

#donatediv {


width: 220px;
margin-left:0;
margin-bottom:10px;
margin-top:20px;
margin-right:20px;
float:right;

}

#leftcontainer {

width: 500px;
height: 300px;
margin-left:auto;
margin-right:20px;
margin-bottom:20px;
margin-top:20px;
float:right;
overflow:auto;
}

#rightsidebar{

margin-left:0px;
margin-right:auto;
margin-top:20px;
margin-bottom:20px;
width:180px;
float:right;

}

#footer {

text-align:center;
height: 100px;
width:100%;
clear: both;
padding: 25px;
background-color:#000000;

}//

thanks!

Excavator
12-22-2009, 06:11 PM
Hello Whiskeyeffect,
I'm not sure what you want it to do.
You can get a background to resize along with a browers resize but it's going to skew it out of proportion.
Have a look at a demo of mine at http://nopeople.com/CSS/background_image_resize/index.html


When posting code, please use the code tags,
- available with the # button in the post edit window.
This will wrap your code in a scroll box which greatly helps the readability of your post.

Rowsdower!
12-22-2009, 06:49 PM
I think I get what you're after, but it seems like you always want the page to be 1280px wide. If that's the case, then all you need to do is the following:


for the footer, remove width:100%; from the style
add background-color:#000000; to the style for the body
add min-width:1280px; to the style for #contentmidcontainer


That should take care of it unless you really mean to have the page be 941px wide with a background that expands up to 1280px on either side. The approach there is a bit different:


for the footer, remove width:100%; from the style
add background:#000000 url(../images/centerbg.jpg) no-repeat scroll left 100px; to the style for the body
remove the background-image style from #contentmidcontainer


Note that this won't specifically center the background image, but it WILL keep it visible and tidy. Actually centering the image on the page while doing this is apparently a bit tricky. I've only ever seen that done with javascript or flash.

Anyway, both of these methods were tested and worked in FF3. If you want something better you might need to search google a bit and/or resort to javascript to get the job done.

Whiskeyeffect
12-22-2009, 07:10 PM
I was actually trying to keep the page width at 941px with an expandable background. Made your suggested adjustments. . .Works like a charm man! You're a life saver. Check it out now.

http://www.radiointifadathemovie.com

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum