<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hex to Decimal Converter</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #0f172a;
color: #e2e8f0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
}
.container {
background: #1e293b;
padding: 32px;
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0,0,0,0.4);
width: 100%;
max-width: 420px;
}
h1 {
margin: 0 0 24px;
font-size: 24px;
text-align: center;
color: #38bdf8;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #94a3b8;
}
input {
width: 100%;
padding: 12px;
border: 2px solid #334155;
border-radius: 8px;
background: #0f172a;
color: #f1f5f9;
font-size: 16px;
margin-bottom: 16px;
box-sizing: border-box;
}
input:focus {
outline: none;
border-color: #38bdf8;
}
.output {
background: #0f172a;
padding: 12px;
border-radius: 8px;
font-size: 18px;
min-height: 24px;
word-break: break-all;
border: 2px solid #334155;
}
.error {
color: #f87171;
font-size: 14px;
margin-top: 8px;
height: 20px;
}
</style>
</head>
<body>
<div class="container">
<h1>Hex → Decimal</h1>
<label for="hexInput">Hex Value</label>
<input type="text" id="hexInput" placeholder="e.g. FF, 1A3F, 0x2B" autocomplete="off">
<label>Decimal Result</label>
<div class="output" id="decOutput">0</div>
<div class="error" id="error"></div>
</div>
<script>
const hexInput = document.getElementById('hexInput');
const decOutput = document.getElementById('decOutput');
const error = document.getElementById('error');
hexInput.addEventListener
No comments:
Post a Comment