<!DOCTYPE html> <html> <head> <metahttp-equiv="Content-Type"content="text/html; charset=utf-8" /> <title>Typing effect with js</title> <style> .divcss5{word-wrap:break-word;font-size: 36px;} </style> </head> <body> <divclass="divcss5"id="aa"> In the past, to achieve an effect similar to typing on a computer, js+html was required. Today I will introduce a new method.This article mainly </div> <divstyle="display:none"id="w"> In the past, to achieve an effect similar to typing on a computer, js+html was required. Today I will introduce a new method.This article mainly introduces pure html+css to achieve typing effect, which has certain reference value, you can learn about it. Provide all the code, you can use it directly. </div> <scriptlanguage="javascript"> var index=0; var word=document.getElementById("w").innerHTML; functiontype(){ document.getElementById("aa").innerText = word.substring(0,index++); } setInterval(type, 200); </script> </body> </html>