how to make the a div below the button move down when button is clicked in css

Viewed 297

Aim: that when send button is clicked for the div below moves down as well meaning they dont overlap eachother.

problem: that when the send button is clicked teh box that animates out overlaps the div below making it look bad. this is what im trying to fix

before being clicked what it looks like at the moment

after being clickedwhat it looks like when button is clicked

.share-container {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 300px;
  width: 350px;
  margin-bottom: 30px;
  margin-top: 30px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

li {
  color: black;
}

.share-link {
  width: 40px;
  height: 10px;
  position: absolute;
  background-color: #fff;
  border-radius: 50%;
  transition: all 0.5s ease;
  box-shadow: 3px 5px 10px rgba(23, 22, 36, 0.4);
  overflow: hidden;
}

.share-link li {
  opacity: 0;
  color: black;
  text-transform: uppercase;
  width: 100%;
  margin: auto 0;
  display: flex;
  justify-content: start;
  flex-direction: row;
  margin-bottom: 2px;
  padding: 7.5px 0 7.5px 20px;
  cursor: pointer;
}

.share-link li i {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  transition: all 0.3s ease 1s;
}

.share-link.active li:nth-child(1) {
  transition: all 0.3s ease 0.8s;
}

.share-link.active li:nth-child(2) {
  transition: all 0.3s ease 1s;
}

.share-link.active li:nth-child(3) {
  transition: all 0.3s ease 1.2s;
}

.share-link.active li {
  transition: all 0.5s ease 0.7s;
  opacity: 1;
  font-size: 13.5px;
}

.share-link.active {
  width: 170px;
  height: 130px;
  border-radius: 15px;
  transform: translate(-22%, 23%);
  transition: all 0.5s ease 0.4s;
  padding: 10px 0;
}

.send,
.close {
  color: #1c92d2;
  font-size: 20px;
}

.whatsapp,
.mail {
  color: #1c92d2;
  font-size: 19px;
}

a {
  text-decoration: none;
}

li a {
  color: black !important;
}

.social-link {
  width: 50px;
  height: 50px;
  overflow: hidden;
  background-color: #fff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: absolute;
  transition: transform 0.3s ease-in-out;
  border: 2px solid #1c92d2;
}

.social-link .send {
  width: 50%;
  margin-top: 2px;
  position: absolute;
  transition: transform 0.3s ease;
  transition-delay: 0.2s;
  animation: sendback 0.3s ease-in-out 0.5s;
}

.social-link .close {
  width: 25%;
  position: absolute;
  transform: scale(0);
  animation: rotate-reverse 0.4s ease;
}

.social-link.active {
  transition-delay: 0.3s;
  transform: translate(100%, 100%);
}

.social-link.active .send {
  transition-delay: 0.5s;
  transform: translate(94%, 94%);
}

.social-link.active .close {
  transform: scale(1);
  transition-delay: 0.7s;
  animation: rotate 0.3s ease 0.7s;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg) scale(0);
  }
  100% {
    transform: rotate(90deg) scale(1);
  }
}

@keyframes rotate-reverse {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(-90deg) scale(0);
  }
}
<div class="share-container">
  <ul class="share-link">

    <li>
      <a href="">
        <i class="fab whatsapp fa-whatsapp" alt="Whatsapp"></i>Whatsapp</a>

    </li>
    <li>
      <a href="{{ photo.img.url }}" download="{{ photo.img.url }}">


        <i class="fas fa-cloud-download-alt dnld" type="submit"></i>Download</a>
    </li>
    <li>
      <a href="">
        <i class="fas fa-envelope mail" alt="mail"></i>Email</a>


    </li>
  </ul>
  <div class="social-link">
    <i class="send fas fa-paper-plane" alt="send"></i>
    <i class="close fas fa-times" alt="close"></i>
  </div>
</div>
</div>
<div class="email-list">
  <h4>Join our email list to get new updates</h4>

  <div style="background-color: #d9edf7; border-radius: 10px;">
    {% if messages %} {% for message in messages %}
    <p class="send-message" style="">{{ message }}</p>
    {% endfor %} {% endif %}
  </div>

  <form method="post" enctype="multipart/form-data">
    {% csrf_token %}


    <button type="submit" class="btn button-animate" id="anonimize-btn">Submit</button>
  </form>
</div>


```

thank you inadvance any answers are helpful

1 Answers

I've added padding-bottom: 100px; to the .share-container to push contents down when the container is open.

.share-container {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 300px;
  width: 350px;
  margin-bottom: 30px;
  margin-top: 30px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 100px;
}

li {
  color: black;
}

.share-link {
  width: 40px;
  height: 10px;
  position: absolute;
  background-color: #fff;
  border-radius: 50%;
  transition: all 0.5s ease;
  box-shadow: 3px 5px 10px rgba(23, 22, 36, 0.4);
  overflow: hidden;
}

.share-link li {
  opacity: 0;
  color: black;
  text-transform: uppercase;
  width: 100%;
  margin: auto 0;
  display: flex;
  justify-content: start;
  flex-direction: row;
  margin-bottom: 2px;
  padding: 7.5px 0 7.5px 20px;
  cursor: pointer;
}

.share-link li i {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  transition: all 0.3s ease 1s;
}

.share-link.active li:nth-child(1) {
  transition: all 0.3s ease 0.8s;
}

.share-link.active li:nth-child(2) {
  transition: all 0.3s ease 1s;
}

.share-link.active li:nth-child(3) {
  transition: all 0.3s ease 1.2s;
}

.share-link.active li {
  transition: all 0.5s ease 0.7s;
  opacity: 1;
  font-size: 13.5px;
}

.share-link.active {
  width: 170px;
  height: 130px;
  border-radius: 15px;
  transform: translate(-22%, 23%);
  transition: all 0.5s ease 0.4s;
  padding: 10px 0;
}

.send,
.close {
  color: #1c92d2;
  font-size: 20px;
}

.whatsapp,
.mail {
  color: #1c92d2;
  font-size: 19px;
}

a {
  text-decoration: none;
}

li a {
  color: black !important;
}

.social-link {
  width: 50px;
  height: 50px;
  overflow: hidden;
  background-color: #fff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: absolute;
  transition: transform 0.3s ease-in-out;
  border: 2px solid #1c92d2;
}

.social-link .send {
  width: 50%;
  margin-top: 2px;
  position: absolute;
  transition: transform 0.3s ease;
  transition-delay: 0.2s;
  animation: sendback 0.3s ease-in-out 0.5s;
}

.social-link .close {
  width: 25%;
  position: absolute;
  transform: scale(0);
  animation: rotate-reverse 0.4s ease;
}

.social-link.active {
  transition-delay: 0.3s;
  transform: translate(100%, 100%);
}

.social-link.active .send {
  transition-delay: 0.5s;
  transform: translate(94%, 94%);
}

.social-link.active .close {
  transform: scale(1);
  transition-delay: 0.7s;
  animation: rotate 0.3s ease 0.7s;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg) scale(0);
  }
  100% {
    transform: rotate(90deg) scale(1);
  }
}

@keyframes rotate-reverse {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(-90deg) scale(0);
  }
}
<div class="share-container">
  <ul class="share-link">

    <li>
      <a href="">
        <i class="fab whatsapp fa-whatsapp" alt="Whatsapp"></i>Whatsapp</a>

    </li>
    <li>
      <a href="{{ photo.img.url }}" download="{{ photo.img.url }}">


        <i class="fas fa-cloud-download-alt dnld" type="submit"></i>Download</a>
    </li>
    <li>
      <a href="">
        <i class="fas fa-envelope mail" alt="mail"></i>Email</a>


    </li>
  </ul>
  <div class="social-link">
    <i class="send fas fa-paper-plane" alt="send"></i>
    <i class="close fas fa-times" alt="close"></i>
  </div>
</div>
</div>
<div class="email-list">
  <h4>Join our email list to get new updates</h4>

  <div style="background-color: #d9edf7; border-radius: 10px;">
    {% if messages %} {% for message in messages %}
    <p class="send-message" style="">{{ message }}</p>
    {% endfor %} {% endif %}
  </div>

  <form method="post" enctype="multipart/form-data">
    {% csrf_token %}


    <button type="submit" class="btn button-animate" id="anonimize-btn">Submit</button>
  </form>
</div>


```

Related