Percentage Calculator
Budget Calculator * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; color: #333; } .container { max-width: 400px; margin: 0 auto; padding: 20px; } .header { text-align: center; margin-bottom: 30px; color: white; } .header h1 { font-size: 28px; font-weight: bold; margin-bottom: 10px; } .header p { font-size: 16px; opacity: 0.9; } .card { background: white; border-radius: 20px; padding: 25px; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); } .input-section { margin-bottom: 30px; } .input-label { font-size: 18px; font-weight: 600; margin-bottom: 15px; color: #333; } .input-container { position: relative; } .currency-symbol { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 24px; color: #666; font-weight: bold; } .amount-input { width: 100%; padding: 15px 15px 15px 50px; font-size: 24px; border: 2px solid #e0e0e0; border-radius: 12px; outline: none; transition: all 0.3s ease; } .amount-input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); } .calculate-btn { width: 100%; padding: 15px; font-size: 18px; font-weight: 600; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 12px; cursor: pointer; transition: all 0.3s ease; margin-top: 20px; } .calculate-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3); } .calculate-btn:active { transform: translateY(0); } .results { margin-top: 20px; } .results-header { font-size: 20px; font-weight: 700; margin-bottom: 20px; text-align: center; color: #333; } .category-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; margin-bottom: 10px; background: #f8f9ff; border-radius: 12px; border-left: 4px solid; transition: all 0.3s ease; } .category-item:hover { transform: translateX(5px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); } .category-item.tithe { border-left-color: #9c27b0; } .category-item.home { border-left-color: #2196f3; } .category-item.charity { border-left-color: #f44336; } .category-item.clothing { border-left-color: #4caf50; } .category-item.vacation { border-left-color: #ff9800; } .category-item.savings { border-left-color: #673ab7; } .category-item.remaining { border-left-color: #795548; background: #e8f5e8; font-weight: 600; } .category-info { display: flex; align-items: center; } .category-icon { font-size: 24px; margin-right: 12px; } .category-details h4 { font-size: 16px; font-weight: 600; margin-bottom: 2px; } .category-details p { font-size: 14px; color: #666; } .category-amount { font-size: 18px; font-weight: 700; color: #333; } .total-section { margin-top: 20px; padding: 15px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 12px; color: white; text-align: center; } .total-amount { font-size: 24px; font-weight: bold; } .hidden { display: none; } .tips-section { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); border-radius: 15px; padding: 20px; margin-top: 20px; } .tips-header { font-size: 18px; font-weight: 600; margin-bottom: 15px; color: #8b4513; } .tips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .tip-item { background: rgba(255, 255, 255, 0.7); padding: 10px; border-radius: 8px; text-align: center; } .tip-item .icon { font-size: 20px; margin-bottom: 5px; } .tip-item .name { font-size: 12px; font-weight: 600; color: #8b4513; } .tip-item .percentage { font-size: 10px; color: #a0522d; } @media (max-width: 480px) { .container { padding: 15px; } .card { padding: 20px; } .amount-input { font-size: 20px; } }
Budget Calculator
Calculate Budget Your Budget Breakdown Total Amount ₹0
Budget Categories
Tithe 10%
Home Improvement 7%
Charity 3%
Clothing 2%
Vacation 3%
Savings 5% const categories = [ { name: 'Tithe', percentage: 10, icon: '🙏', class: 'tithe' }, { name: 'Home Improvement', percentage: 7, icon: '🏠', class: 'home' }, { name: 'Charity', percentage: 3, icon: '❤', class: 'charity' }, { name: 'Clothing', percentage: 2, icon: '👕', class: 'clothing' }, { name: 'Vacation', percentage: 3, icon: '✈', class: 'vacation' }, { name: 'Assorted Savings', percentage: 5, icon: '💰', class: 'savings' }, { name: 'Remaining', percentage: 70, icon: '💵', class: 'remaining' } ]; function formatIndianCurrency(amount) { return new Intl.NumberFormat('en-IN').format(amount); } function calculateBudget() { const amountInput = document.getElementById('amountInput'); const amount = parseFloat(amountInput.value); if (!amount || amount <= 0) { alert('Please enter a valid amount'); return; } // Hide tips section and show results document.getElementById('tipsSection').classList.add('hidden'); document.getElementById('resultsCard').classList.remove('hidden'); // Calculate and display results const resultsContainer = document.getElementById('resultsContainer'); const totalAmount = document.getElementById('totalAmount'); resultsContainer.innerHTML = ''; categories.forEach(category => { const categoryAmount = (amount * category.percentage / 100); const categoryElement = document.createElement('div'); categoryElement.className = `category-item ${category.class}`; categoryElement.innerHTML = ` <div class="category-info"> <div class="category-icon">${category.icon}</div> <div class="category-details"> <h4>${category.name}</h4> <p>${category.percentage}% of total</p> </div> </div> <div class="category-amount">₹${formatIndianCurrency(categoryAmount.toFixed(2))}</div> `; resultsContainer.appendChild(categoryElement); }); totalAmount.textContent = `₹${formatIndianCurrency(amount.toFixed(2))}`; } // Allow Enter key to calculate document.getElementById('amountInput').addEventListener('keypress', function(event) { if (event.key === 'Enter') { calculateBudget(); } }); // Reset to tips when input is cleared document.getElementById('amountInput').addEventListener('input', function() { if (!this.value) { document.getElementById('tipsSection').classList.remove('hidden'); document.getElementById('resultsCard').classList.add('hidden'); } });
Budget Calculator Smart financial planning made easy
Enter Amount ₹
Calculate Budget Your Budget Breakdown Total Amount ₹0
Budget Categories
Tithe 10%
Home Improvement 7%
Charity 3%
Clothing 2%
Vacation 3%
Savings 5% const categories = [ { name: 'Tithe', percentage: 10, icon: '🙏', class: 'tithe' }, { name: 'Home Improvement', percentage: 7, icon: '🏠', class: 'home' }, { name: 'Charity', percentage: 3, icon: '❤', class: 'charity' }, { name: 'Clothing', percentage: 2, icon: '👕', class: 'clothing' }, { name: 'Vacation', percentage: 3, icon: '✈', class: 'vacation' }, { name: 'Assorted Savings', percentage: 5, icon: '💰', class: 'savings' }, { name: 'Remaining', percentage: 70, icon: '💵', class: 'remaining' } ]; function formatIndianCurrency(amount) { return new Intl.NumberFormat('en-IN').format(amount); } function calculateBudget() { const amountInput = document.getElementById('amountInput'); const amount = parseFloat(amountInput.value); if (!amount || amount <= 0) { alert('Please enter a valid amount'); return; } // Hide tips section and show results document.getElementById('tipsSection').classList.add('hidden'); document.getElementById('resultsCard').classList.remove('hidden'); // Calculate and display results const resultsContainer = document.getElementById('resultsContainer'); const totalAmount = document.getElementById('totalAmount'); resultsContainer.innerHTML = ''; categories.forEach(category => { const categoryAmount = (amount * category.percentage / 100); const categoryElement = document.createElement('div'); categoryElement.className = `category-item ${category.class}`; categoryElement.innerHTML = ` <div class="category-info"> <div class="category-icon">${category.icon}</div> <div class="category-details"> <h4>${category.name}</h4> <p>${category.percentage}% of total</p> </div> </div> <div class="category-amount">₹${formatIndianCurrency(categoryAmount.toFixed(2))}</div> `; resultsContainer.appendChild(categoryElement); }); totalAmount.textContent = `₹${formatIndianCurrency(amount.toFixed(2))}`; } // Allow Enter key to calculate document.getElementById('amountInput').addEventListener('keypress', function(event) { if (event.key === 'Enter') { calculateBudget(); } }); // Reset to tips when input is cleared document.getElementById('amountInput').addEventListener('input', function() { if (!this.value) { document.getElementById('tipsSection').classList.remove('hidden'); document.getElementById('resultsCard').classList.add('hidden'); } }); The post Percentage Calculator first appeared on Ronald Hadrian.
Published on September 27, 2025 04:59
No comments have been added yet.


