Pages

Wednesday, 18 December 2024

Reading Time Calculator Tool



Reading Time Calculator

Reading Time Calculator

Enter your text to calculate how long it will take to read.

Estimated reading time: 0 minutes.

Made with 💻 by YourName

/* Basic Reset */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Roboto', sans-serif; background: linear-gradient(135deg, #f06, #4a90e2); display: flex; justify-content: center; align-items: center; height: 100vh; } .container { background-color: white; border-radius: 10px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); width: 90%; max-width: 600px; padding: 20px; } .tool-header { text-align: center; margin-bottom: 20px; } .tool-header h1 { color: #333; font-size: 2.5em; } .tool-header p { color: #666; font-size: 1.1em; } .input-area { margin-bottom: 20px; } textarea { width: 100%; height: 150px; padding: 10px; font-size: 1em; border: 2px solid #ddd; border-radius: 8px; resize: vertical; transition: border-color 0.3s ease; } textarea:focus { border-color: #4a90e2; outline: none; } .options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } input[type="number"] { width: 100px; padding: 8px; font-size: 1em; border: 2px solid #ddd; border-radius: 5px; text-align: center; } .result { text-align: center; } button { background-color: #4a90e2; color: white; padding: 10px 20px; font-size: 1.2em; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #357ab7; } footer { text-align: center; margin-top: 20px; color: #777; } footer p { font-size: 0.9em; } /* Responsive Design */ @media (max-width: 600px) { .tool-header h1 { font-size: 2em; } .options { flex-direction: column; align-items: flex-start; } .options label, .options input { margin-bottom: 10px; } } function calculateReadingTime() { // Get the text input and reading speed const text = document.getElementById("textInput").value; const readingSpeed = parseInt(document.getElementById("readingSpeed").value, 10); // Check if there's any text if (text.trim() === "") { alert("Please enter some text."); return; } // Calculate word count by splitting the text by spaces const words = text.trim().split(/\s+/).length; // Calculate reading time in minutes const readingTime = Math.ceil(words / readingSpeed); // Display the result document.getElementById("output").innerHTML = `Estimated reading time: ${readingTime} minute(s).`; }