<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Typing Simulator</title> <style> body { background-color: #121212; /* Midnight Black */ color: #cfcfcf; /* Light Grey Text */ font-family: 'Courier New', monospace; text-align: center; margin: 50px; } #container { background-color: #1f1f1f; /* Dark Grey */ padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); max-width: 600px; margin: auto; display: flex; flex-direction: column; align-items: center; } label, textarea, button, input { display: block; margin: 10px 0; box-sizing: border-box; } input { height: 30px; width: 100%; background-color: #2ecc71; /* Avocado Green */ color: #cfcfcf; /* Light Grey Text */ border: 1px solid #27ae60; /* Darker Green Border */ border-radius: 5px; padding: 5px; animation: glowGreen 1.5s infinite alternate; /* Green Glow Animation */ } textarea { height: 100px; width: 100%; resize: none; background-color: #333; /* Dark Grey */ color: #cfcfcf; /* Light Grey Text */ border: 1px solid #444; /* Darker Grey Border */ border-radius: 5px; padding: 10px; } button { width: 100%; /* Increased width for a bigger appearance */ height: 40px; background-color: #8e44ad; /* Purple */ color: #cfcfcf; /* Light Grey Text */ border: none; border-radius: 5px; cursor: pointer; animation: glowPurple 1.5s infinite alternate; /* Purple Glow Animation */ } #output { margin-top: 20px; font-weight: bold; color: #55aaff; /* Light Blue */ white-space: pre-wrap; text-align: left; width: 100%; } label { position: relative; display: inline-block; font-size: 16px; } @keyframes glowGreen { from { box-shadow: 0 0 10px #2ecc71, 0 0 20px #2ecc71; } to { box-shadow: 0 0 20px #2ecc71, 0 0 30px #2ecc71; } } @keyframes glowPurple { from { box-shadow: 0 0 10px #8e44ad, 0 0 20px #8e44ad; } to { box-shadow: 0 0 20px #8e44ad, 0 0 30px #8e44ad; } } </style> </head> <body> <div id="container"> <label for="speed">Select Speed:</label> <input type="number" id="speed" placeholder="Type speed in characters per second"> <textarea id="textInput" placeholder="Type your text here"></textarea> <button onclick="startTyping()">Confirm</button> <div id="output"></div> </div> <script> function startTyping() { const speedInput = document.getElementById("speed"); const textInput = document.getElementById("textInput"); const outputDiv = document.getElementById("output"); const speed = parseInt(speedInput.value); const text = textInput.value; if (isNaN(speed) || speed <= 0) { alert("Please enter a valid positive speed."); return; } outputDiv.innerHTML = ""; let index = 0; let spaces = 0; const intervalId = setInterval(() => { if (index >= text.length) { clearInterval(intervalId); } else { const char = text[index]; if (char === ' ' || char === '\t') { spaces++; } else { outputDiv.textContent += ' '.repeat(spaces) + char; spaces = 0; } index++; } }, 1000 / speed); } </script> </body> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>