All Rounder Tools Blogger-Best blog for blogger: Decimal to HEX converter Tool with colorful styling and all its features use any free library

Saturday, September 28, 2024

Decimal to HEX converter Tool with colorful styling and all its features use any free library

 

Decimal to HEX Converter

Decimal to HEX Converter

HEX Value:

#

body { font-family: Arial, sans-serif; background: linear-gradient(to right, #ff7e5f, #feb47b); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background: white; border-radius: 15px; padding: 20px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); text-align: center; max-width: 400px; width: 100%; } h1 { color: #333; } input[type="number"] { width: 100%; padding: 10px; border: 2px solid #feb47b; border-radius: 5px; margin-bottom: 10px; font-size: 16px; } button { background-color: #ff7e5f; color: white; border: none; padding: 10px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.3s; } button:hover { background-color: #feb47b; } .result { margin-top: 20px; } h2 { color: #333; } #hexOutput { font-size: 24px; font-weight: bold; color: #ff7e5f; } document.getElementById("convertButton").addEventListener("click", function() { const decimalInput = document.getElementById("decimalInput").value; const hexOutput = document.getElementById("hexOutput"); if (decimalInput === "") { hexOutput.textContent = "Please enter a valid number!"; return; } const decimalNumber = parseInt(decimalInput, 10); if (isNaN(decimalNumber) || decimalNumber < 0) { hexOutput.textContent = "Please enter a positive integer!"; } else { const hexValue = decimalNumber.toString(16).toUpperCase(); hexOutput.textContent = `#${hexValue}`; } });

No comments:

Post a Comment