Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

CSS Ending CSS animation display

chrisj

Bronze Coder
This css code slides and displays text successfully.

How/where can I add the ability for the text to disappear/end (or fade-away)?

CSS:
.slide-effect {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slideUp {
  position: relative;
  font-family: tahoma;
  font-size: 35px;
  opacity:0;
}

.slideUp {
  top:40px;
  left:10px;
   animation: slideUp ease 1.5s forwards 4.2s;
  color:#fff;
  opacity:0;
}

@keyframes slideUp {
  0% {transform: translateY(0);}
  100% {transform: translateY(-40px);opacity:1;}
}

Here's the html:

HTML:
<div class="slide-effect">
<div class="slideUp">Slide Up</div>
</div>
 
Last edited:
Solution
Do you mean like this?
CSS:
@keyframes slideUp {
  0% {transform: translateY(0);}
  99.999% {transform: translateY(-40px); opacity:1;}
  100% {transform: translateY(-40px); opacity:0;}
}
Do you mean like this?
CSS:
@keyframes slideUp {
  0% {transform: translateY(0);}
  99.999% {transform: translateY(-40px); opacity:1;}
  100% {transform: translateY(-40px); opacity:0;}
}
 
Solution
Thanks again.
I have two slide ups, but they appear so slowly.
I'd like to have them display quickly (after delay), stay displayed for several seconds, then disappear.
But currently, they slide up too slowly. Any additional guidance is welcomed.

CSS:
.slide-effect {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slideUp, .slideUp1 {
  position: relative;
  font-family: tahoma;
  font-size: 35px;
  opacity:0;
}

.slideUp {
top:40px;
left:10px;
animation: slideUp ease .5s forwards 1.2s;
animation-duration: 9s;
}

.slideUp1 {
top:40px;
left:10px;
animation: slideUp .5s ease forwards 4s;
animation-duration: 9s;
}

@keyframes slideUp {

0% {transform: translateY(0);
opacity:1;
}

85% {
transform: translateY(-40px);
opacity:0.5;
}
99.999% {transform: translateY(-40px);
opacity:1;
}
100% {transform: translateY(-40px);
opacity:0;
}
}


HTML:
<div class="slide-effect">
<div class="slideUp">Slide Up</div><div class="slideUp1">SlideUp1</div>
</div>
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom