Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [SOLVED] Stretch div height and footer disapearing

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #32305
    HeatherDawn
    Member

    Hi everyone, I’m new here and looking for a CSS community to participate it. I do graphic design on the side and end up doing a lot of web development. Jobs tend to be far apart and I always seem to have to refresh my memory. eek!

    Anyway… here’s my problems I’m dealing with right now:

    Site I’m referring to: http://dawn-creative.com/svtap/index.html

    1. I need the scroll background image in the #scroll div to stretch all the way to the bottom.
    2. I’m using z-index to keep the grass footer in front of the scroll which works, however (and you’ll need to make your browser window small to see it), when you start scrolling far enough down, the grass starts to disappear.
    3. When browser is full screen, bottom of footer disappears.

    I’ve been doing research on all problems and tried to “fix” it and am so overwhelmed by all the information that I don’t even know what I’ve done at this point.

    Any help would be great. Thank you!

    HTML:








    Welcome


    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamtus metus neque, cursus ut dapibus nec, mattis eu orci. Phasellus molestie aliquam nisi, non dapibus orci pretium sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed semper adipiscing arcu, ac dictum sem pulvinar id. Proin libero enim, sodales eu convallis et, posuere quis tellus.


    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamtus metus neque, cursus ut dapibus nec, mattis eu orci. Phasellus molestie aliquam nisi, non dapibus orci pretium sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed semper adipiscing arcu, ac dictum sem pulvinar id. Proin libero enim, sodales eu convallis et, posuere quis tellus.













    CSS:

    @import "reset.css";

    body {
    background-color: #c0d0e0;
    background-image: url(../images/bground-default.jpg);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: bottom;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    height: 100%;
    }

    @font-face {
    font-family: "CustomFont";
    src: url(../style/BEFRISKY.TTF);
    }


    h1 {
    font-family: CustomFont, Arial;
    font-size: 140%;
    margin-bottom: 7px;
    }

    h2 {
    font-family: CustomFont, Arial;
    font-size: 125%;
    margin-bottom: 7px;
    }

    h3 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 90%;
    font-weight: lighter;
    }

    p {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 85%;
    margin-bottom: 7px;
    }

    #scroll {
    margin: 0 auto 0 auto;
    background-image: url(../images/scroll.png);
    background-repeat: no-repeat;
    position: relative;
    top: 100px;
    width: 670px;
    height: 100%;
    padding: 140px 65px 50px 65px;
    z-index: -1;
    }

    #header {
    position: relative;
    width: 670px;
    }

    #nav {
    position: absolute;
    bottom: 0;
    right: 0;
    }

    #nav li{
    font-family: CustomFont, Arial;
    font-size: 140%;
    list-style-type: none;
    display:: inline;
    float: left;
    margin-left: 50px;
    }

    #content-container{
    width: 100%;
    min-height: 100%; !important
    height: auto;
    margin: 25px 0 0 0;
    z-index: 0;
    }

    #main-content {
    width: 450px;
    float: left;
    }

    #sidebar {
    width: 175px;

    float: right;
    padding: 0 0 0 25px;
    border-left: solid thin #666;
    }

    .sidebar-section {
    margin: 0 0 25px 0;
    }

    #footer {
    background-image: url(../images/grass.png);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: bottom;
    width: 850px;
    min-height: 335px;
    margin: 0 auto 0 auto;
    z-index: 10;
    }
    #51664

    Edit: I missed a closing tag, same issue but for different reason.
    Looks like you need to clear #content-container like you’ve done for #scroll since both of the divs inside #content-container are floated.


    Best practice would be to turn that inline styling for clearing into a class
    .clear {clear:both} and apply to the each to each of the clearing divs.

    #51667
    DogsGhost
    Member

    whiteInk is right about the div tag, but its not really part of your issue. I messed around with your css and seemed to get something that worked changing a few things, explanations are commented in the css below.


    #scroll {
    background: url(../images/scroll.png) no-repeat; /* shorthand */
    position: relative;
    width: 670px;
    margin: 50px auto 0; /* added top margin instead of the top:100px you had */
    padding: 140px 65px 50px;
    z-index: -1;
    }
    #content-container {
    margin: 25px 0 0; /* only property you had listed here that seemed to be doing anything */
    }
    #main-content {
    margin-bottom:100px; /* prevents content at the bottom from being covered by grass */
    width: 450px;
    min-height:450px; /* a semi-solution for keeping the bottom of the scroll down behind the grass in most browsers */
    float: left;
    }
    #footer {
    background: url(../images/grass.png) no-repeat; /* shorthand */
    position: fixed; /* rather than fix the bg img i'm positioning the whole footer fixed to the bottom */
    bottom: 0px;
    left: 50%; /* this and the negative margin below keep it centered on the page */
    width: 850px;
    height: 335px;
    margin-left: -425px;
    z-index: 10; /* originally you had no position declared for the footer, z-index doesn't work without a declared position, even if its just position:relative */
    }

    Hope that helps.

    #51679
    HeatherDawn
    Member

    Thank you guys soooo much!! Between the both of you I think it has been figured out.

    Question, though… why on #footer does margin: 0 auto 0 auto; not work for centering it? Why instead do I have to do the left: 50%; and margin-left: -425px;?

    Again, thanks for the help. I thought I was losing my mind.

    #51622
    DogsGhost
    Member

    Auto margins stop working for positioning on #footer because I changed it to position:fixed.
    Left 50% places the front of the footer at the middle of the page, then the -425px (half the width of the footer) moves its halfway back to the left, resulting in constant centering.

    #51623
    HeatherDawn
    Member

    Good to know!

    Also, I’m assuming my footer image was disappearing before because I was positioning the background image instead of the div… correct?

    #51611
    DogsGhost
    Member

    Correct.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.