|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8" /> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
<title>β¨ Basic Addition Calculator β¨</title> |
|
<style> |
|
body { |
|
font-family: 'Segoe UI', sans-serif; |
|
background: linear-gradient(to right, #fbc2eb, #a6c1ee); |
|
text-align: center; |
|
padding: 50px 20px; |
|
color: #333; |
|
} |
|
h1 { |
|
font-size: 2.5em; |
|
color: #4a148c; |
|
animation: sparkle 2s infinite; |
|
} |
|
input { |
|
width: 80px; |
|
padding: 10px; |
|
margin: 10px; |
|
font-size: 1.2em; |
|
border: 2px solid #ccc; |
|
border-radius: 10px; |
|
text-align: center; |
|
} |
|
button { |
|
padding: 12px 24px; |
|
font-size: 1.1em; |
|
background-color: #6a1b9a; |
|
color: white; |
|
border: none; |
|
border-radius: 20px; |
|
cursor: pointer; |
|
transition: background 0.3s ease; |
|
} |
|
button:hover { |
|
background-color: #8e24aa; |
|
} |
|
.result { |
|
font-size: 1.8em; |
|
margin-top: 30px; |
|
color: #2e7d32; |
|
} |
|
.footer { |
|
margin-top: 50px; |
|
font-size: 1.2em; |
|
color: #0d47a1; |
|
} |
|
@keyframes sparkle { |
|
0%, 100% { color: #4a148c; } |
|
50% { color: #ff4081; } |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<h1>β¨ Basic Addition Calculator β¨</h1> |
|
|
|
<input type="number" id="num1" placeholder="12" /> |
|
<span style="font-size: 2em;">β</span> |
|
<input type="number" id="num2" placeholder="12" /> |
|
<br /> |
|
<button onclick="calculateSum()">Calculate β‘οΈ</button> |
|
|
|
<div class="result" id="resultArea"></div> |
|
|
|
<div class="footer">π Hope you have a nice day! π</div> |
|
|
|
<script> |
|
function calculateSum() { |
|
const n1 = parseFloat(document.getElementById('num1').value); |
|
const n2 = parseFloat(document.getElementById('num2').value); |
|
|
|
if (isNaN(n1) || isNaN(n2)) { |
|
document.getElementById('resultArea').innerHTML = "β Please enter both numbers!"; |
|
return; |
|
} |
|
|
|
const sum = n1 + n2; |
|
document.getElementById('resultArea').innerHTML = |
|
`π The sum of ${n1} and ${n2} is: <strong>${sum}</strong> π`; |
|
} |
|
</script> |
|
</body> |
|
</html> |
|
|
|
|
|
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference |