papibulgaria
papibulgaria

Reputation: 17

Can't position 1 div under another

I have created div called "footer" it appears always at the bottom when the page loads and goes up when scrolling down. Right now I am trying to position 2x text fields using col-6-lg(bootstrap), they should be under the "footer" and visible after scrolling.

body{
    background-image: url("../img/bg.png");
    background-size: cover;
    background-color: #01383b;
}

#footer {
    position: absolute;
    bottom: 0;
    width: 100%;
}

#content {
    background: #D0E5FF;
    padding: 20px;
    color: #00214B;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.8;
}
#footer {
    opacity: 0.8;
    filter: alpha(opacity=40);
    background: rgb(14, 122, 128);
    line-height: 2;
    text-align: center;
    color: #042E64;
    font-size: 30px;
    font-family: sans-serif;
    font-weight: bold;
    text-shadow: 0 1px 0 #84BAFF;
    box-shadow: 0 0 15px #00214B
}

#button1{
    margin-top: 15px;
}

#button2{
    margin-top: 15px;
    margin-left: 95px;
}

.cd-container {
  width: 90%;
  max-width: 768px;
  margin: 2em auto;
}
.cd-container::after {
  /* clearfix */
  content: '';
  display: table;
  clear: both;
}

.cd-top {
  display: inline-block;
  height: 40px;
  width: 40px;
  position: fixed;
  bottom: 40px;
  right: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);

  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
  background: #3cd8e1 url(../img/cd-top-arrow.svg) no-repeat center 50%;
  visibility: hidden;
  opacity: 0;
  -webkit-transition: opacity .3s 0s, visibility 0s .3s;
  -moz-transition: opacity .3s 0s, visibility 0s .3s;
  transition: opacity .3s 0s, visibility 0s .3s;
}
.cd-top.cd-is-visible, .cd-top.cd-fade-out, .no-touch .cd-top:hover {
  -webkit-transition: opacity .3s 0s, visibility 0s 0s;
  -moz-transition: opacity .3s 0s, visibility 0s 0s;
  transition: opacity .3s 0s, visibility 0s 0s;
}
.cd-top.cd-is-visible {
  visibility: visible;
  opacity: 1;
}
.cd-top.cd-fade-out {
  opacity: .5;
}
.no-touch .cd-top:hover {
  background-color: #3cd8e1;
  opacity: 1;
}
@media only screen and (min-width: 768px) {
  .cd-top {
    right: 20px;
    bottom: 20px;
  }
}
@media only screen and (min-width: 1024px) {
  .cd-top {
    height: 60px;
    width: 60px;
    right: 30px;
    bottom: 30px;
  }
}

.content{
    font-family: 'Open Sans';
    color: #fff;
}
<div id="footer">
   <div class="container">
      <div class="col-lg-8 col-lg-offset-2 text-center">
         <input type="image" src="img/true.png" alt="Submit" width="78" height="78" id="button1">
         <input type="image" src="img/false.png" alt="Submit" width="78" height="78" id="button2">
      </div>
      <div class="col-lg-4 pull-right">
         <a href="#0" class="cd-top cd-is-visible">Top</a>
      </div>
   </div>
</div>
<div class="container">
   <div class="col-lg-6 pull-left text-center">
      <h1>Да, това е!</h1>
   </div>
   <div class="col-lg-6 pull-left text-center">
      <h1>Не, това е Lorem Ipsum</h1>
   </div>
</div>

Upvotes: 0

Views: 59

Answers (1)

Dejan Munjiza
Dejan Munjiza

Reputation: 798

So here is the possible solution. You can wrap both boxes (footer and under-footer container) into, let's call it: footer-wrap. Then, set .footer-wrap {position: absolute;bottom: 0;width: 100%;} And remove positioning classes for #footer from your styles.

 /* #footer {
     position: absolute;
     bottom: 0;
     width: 100%;
   }*/

Set:

 .footer-wrap {
    position: absolute;
    bottom: 0;
    width: 100%;
 }

Here is a demo: https://jsfiddle.net/xvwqt9a0/

Also here is a demo with your style and your html: https://jsfiddle.net/xvwqt9a0/1/

Upvotes: 1

Related Questions