Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I append jumping dots to a text in html and css

Tags:

html

css

How do i append three dots to a text that are jumping, like in google hangouts, when somebody is typing. Is there a css/html only solution for this?

like image 941
lordvlad Avatar asked Jan 21 '26 23:01

lordvlad


1 Answers

It's pretty easy to accomplish with css animation and @keyframes

example on jsbin: http://jsbin.com/lejawoji/1/edit

I'm typing<span class="jumping-dots">
  <span class="dot-1">.</span>
  <span class="dot-2">.</span>
  <span class="dot-3">.</span>
</span>
<style>
.jumping-dots span {
  position: relative;
  bottom: 0px;
  animation: jump 2s infinite;
}
.jumping-dots .dot-1{
  animation-delay: 200ms;
}
.jumping-dots .dot-2{
  animation-delay: 400ms;
}
.jumping-dots .dot-3{
  animation-delay: 600ms;
}

@keyframes jump {
  0%   {bottom: 0px;}
  20%  {bottom: 5px;}
  40%  {bottom: 0px;}
}
</style>
like image 169
lordvlad Avatar answered Jan 24 '26 15:01

lordvlad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!