Pages

Thursday, 19 December 2024

Case Converter Tool



Case Converter Tool

Case Converter Tool

* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f7f7f7; display: flex; justify-content: center; align-items: center; min-height: 100vh; } .container { background-color: #fff; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); padding: 20px; width: 90%; max-width: 500px; text-align: center; } .header h1 { font-size: 2rem; color: #3a3a3a; margin-bottom: 20px; } textarea { width: 100%; padding: 10px; margin: 10px 0; font-size: 1rem; border-radius: 5px; border: 1px solid #ddd; background-color: #fafafa; resize: vertical; } textarea:focus { outline: none; border-color: #7fa8e2; } .buttons { margin: 20px 0; } button { background-color: #4caf50; color: white; border: none; padding: 10px 20px; font-size: 1rem; cursor: pointer; border-radius: 5px; margin: 5px; transition: background-color 0.3s ease; } button:hover { background-color: #45a049; } .btn-uppercase { background-color: #007bff; } .btn-uppercase:hover { background-color: #0056b3; } .btn-lowercase { background-color: #ff5722; } .btn-lowercase:hover { background-color: #e64a19; } .btn-titlecase { background-color: #8bc34a; } .btn-titlecase:hover { background-color: #7cb342; } @media (max-width: 600px) { .container { padding: 15px; } textarea { font-size: 0.9rem; } button { font-size: 0.9rem; padding: 8px 16px; } } function convertToUpperCase() { var inputText = document.getElementById('inputText').value; document.getElementById('outputText').value = inputText.toUpperCase(); } function convertToLowerCase() { var inputText = document.getElementById('inputText').value; document.getElementById('outputText').value = inputText.toLowerCase(); } function convertToTitleCase() { var inputText = document.getElementById('inputText').value; var words = inputText.split(' '); for (var i = 0; i < words.length; i++) { words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1).toLowerCase(); } document.getElementById('outputText').value = words.join(' '); }