Your Blog Post
<html lang="en">
<head>
<title>Word and Character Counter</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f8f9fa;
margin: 0;
justify-content: center;
align-items: center;
}
#counter {
text-align: center;
padding: 20px;
border: 2px solid #007bff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
width: 80%;
max-width: 400px;
}
h2 {
color: #007bff;
}
label {
display: block;
margin-top: 10px;
color: #2c3e50;
}
textarea {
width: 100%;
height: 100px;
padding: 10px;
margin-bottom: 10px;
box-sizing: border-box;
border: 1px solid #bdc3c7;
border-radius: 4px;
resize: vertical;
}
button {
background-color: #007bff;
color: #ffffff;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border-radius: 4px;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
font-size: 18px;
color: #28a745;
}
/* Hide the link */
a[href="https://www.tectuner.com/"] {
display: none;
}
</style>
</head>
<body>
<div id="counter">
<h2>Word and Character Counter</h2>
<label for="inputText">Enter Text:</label>
<textarea id="inputText" placeholder="Type or paste your text here..." required=""></textarea>
<button onclick="countWordsAndCharacters()">Count Words and Characters</button>
<p id="result"></p>
<script>
function countWordsAndCharacters() {
var inputText = document.getElementById('inputText').value;
// Count words
var wordCount = inputText.split(/\s+/).filter(function(word) {
return word.length > 0;
}).length;
// Count characters
var charCount = inputText.length;
var resultString = 'Word count: ' + wordCount + '<br>Character count: ' + charCount;
document.getElementById('result').innerHTML = resultString;
}
</script>
</div>
</body>
</html>