Typing animation with pure CSS

by DJS Baker

HTML

<p class="loadTxt">DANIEL JOHN BAKER<span>&nbsp;</span></p>

CSS

@-webkit-keyframes typing {
    from { width: 100% }
    to { width:0 }
}

@-webkit-keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: black }
}

@-moz-keyframes typing {
    from { width: 100% }
    to { width:0 }
}

@-moz-keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: black }
}

body { font-family: Consolas, monospace; }

.loadTxt { 
    position: relative; 
    float: left;
    font-size:150%;
}

.loadTxt span {
    position:absolute;
    top:0;
    right:0;
    width:0;
    background: white;
    border-left: .1em solid black;
    
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    
    -webkit-animation: typing 5s steps(17, end), /* # of steps = # of characters */
                        blink-caret 1s step-end infinite;
    -moz-animation: typing 5s steps(17, end), /* # of steps = # of characters */
                        blink-caret 1s step-end infinite;
}