1

I am having an issue with my homepage - I do not have enough content for a fullpage and I am trying to set the position of this section above the footer at the bottom.

I had success with using positon: fixed; and bottom: 50px; to sit above my footer, however when I was opening the navigation on an ipad, the navigation would disappear behind the section.

I'm not sure how to tackle the problem, I was attempting to use vertical-align: bottom; but could not get it to work.

My CSS:

section.hero {
    max-height: 400px;
    text-align: center;
    img.hero-responsive {
        width: 100%;
        height: 100px;
    }
    h2 {
        width: 90%;
        margin: 0 auto;
        font-size: 1.5em;
        top: -90px;
        font-weight: 800;
        position: relative;
    }
    h3 {
        position: relative;
        top: -60px;
        font-weight: 800;
    }
}

section.info {
    background-color: #464646;
    height: auto;
    position: relative;
    top: -50px;
    width: 100vw;
    padding: 0px;
    left: -5px;
    text-align: center;
    color: white;
    padding-bottom: 50px;
    .row {
        margin: 0px !important;
        padding: 0px !important;
        .col-lg-3 {
            border-top: 2px solid rgba(160, 160, 160, 0.8);
            margin-top: 5px !important;
            padding: 0px !important;
            i {
                font-size: 40px;
                padding: 10px;
                margin: 25px !important;
                padding: 0px !important;
            }
            i.laravel   { color: #f05340; }
            i.wordpress { color: #21759b; }
            i.sass      { color: #cd6799; }
            img {
                width: 50px;
                height: 40px;
                margin: 10px !important;
                padding: 0px !important;
            }
            h2 {
                margin: 0px !important;
                padding: 0px !important;
            }
            p {
                width: 95%;
                margin: 0px auto 0px auto !important;
                padding: 0px 0px 10px 0px !important;
            }
        }
    }
}
@media only screen and (min-width: 768px) {
  section.hero {
      img.hero-responsive {
          width: 450px;
      }
      h2 {
          width: 400px;
          top: -80px;
      }
  }

  section.info {
      top: auto;
      position: absolute;

  }
}

@media only screen and (min-width: 1000px) {
    section.hero {
        h3 {
            top: -30px;
        }
    }
    section.info {
        min-height: 500px;
        position: unset;
        margin-left: -5px;

    }
}

codepen: https://codepen.io/aparker611/pen/bGbQdqg

problem

codep: https://codepen.io/aparker611/pen/bGbQdqg

2 Answers2

1
<body class="Site">
  <header>…</header>
  <main class="Site-content">…</main>
  <footer>…</footer>
</body>


.Site {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.Site-content {
  flex: 1;
}
0

You can try using flexbox. if you share a codepen or a full example it will more easy to help you

<body class="Site">
  <header>…</header>
  <main class="Site-content">…</main>
  <footer>…</footer>
</body>


.Site {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.Site-content {
  flex: 1;
}

https://codepen.io/centrodph/pen/gOYQpBL

Gerardo Perrucci
  • 704
  • 7
  • 13