Skip to content

Instantly share code, notes, and snippets.

@Techgokul
Created June 12, 2018 16:07
Show Gist options
  • Save Techgokul/56934b773b64e4a915c26282775e0934 to your computer and use it in GitHub Desktop.
Save Techgokul/56934b773b64e4a915c26282775e0934 to your computer and use it in GitHub Desktop.
Create a typing effect in html
<html>
<head>
<title>Type writing</title>
<style>
.btn{
border: none;
background-color: #048bff;
width: 90px;
height: 40px;
font-family: cursive;
}
</style>
</head>
<body>
<button class="btn" onclick="typewriter()">Click me</button>
<p id="demo"></p>
<script type="text/javascript">
var i = 0;
var txt = 'Hey these is gokul welcome to techy tech in these video i am gonna show you how to create a typing effect in html & js';
var speed= 60;
function typewriter()
{
if(i<txt.length)
{
document.getElementById("demo").innerHTML += txt.charAt(i);
i++;
setTimeout(typewriter , speed);
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment