Skip to content Skip to sidebar Skip to footer

How To Reveal One Letter At A Time?

When my web page loads, using CSS, I want the text 'widget world' to appear across the top as if someone were writing it manually; one letter at a time would appear. I'm going to u

Solution 1:

Here's a snippet for something that you are looking for.

p{
  color: Pink; 
  font-family: "Courier";
  font-size: 20px;
  margin: 10px0010px;
  white-space: nowrap;
  overflow: hidden;
  width: 30em;
  animation: type 4ssteps(60, end); 
}

@keyframes type{ 
  from { width: 0; } 
} 
<p>Hi folks, this is typing animation using CSS</p>

Solution 2:

Here's a simple example of what you would do:

var text = 'Widget World';

var textElements = text.split("").map(function(c) {
  return $('<span id="' + c + '">' + c + '</span>');
});

var el = $('#letters');
var delay = 50; // Tune this for different letter delays.
textElements.forEach(function(e, i) {
  el.append(e);
  e.hide();
  setTimeout(function() {
    e.fadeIn(300)
  }, 100 + i * delay)
})
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><divid="letters"></div>

Solution 3:

Maybe this way will fit you: fixed width for inline-block and animation for decrease or increase its width

div {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  animation: example 2s linear 0s infinite alternate;
}

@keyframes example {
  from {
    width: 0;
  }
  to {
    width: 150px;
  }
}
<div>some text</div>

Post a Comment for "How To Reveal One Letter At A Time?"