Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation CSS Background problem. . .

    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!

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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_i...ize/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.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • Users who have thanked Rowsdower! for this post:

    Whiskeyeffect (12-22-2009)

  • #4
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Excellent!

    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •