-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathTip-Calculator.html
More file actions
608 lines (522 loc) · 23.7 KB
/
Tip-Calculator.html
File metadata and controls
608 lines (522 loc) · 23.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tip Calculator Online - Free Tip Calculator Tool</title>
<meta name="description" content="Free tip calculator online to calculate tip amounts and split bills. Easy-to-use tip calculator for restaurants, services, and group dining.">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
background-size: 400% 400%;
animation: gradientShift 15s ease infinite;
}
@keyframes gradientShift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* Above the fold - Calculator section */
.calculator-section {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.calculator {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(20px);
border-radius: 24px;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
padding: clamp(24px, 5vw, 40px);
width: 100%;
max-width: 480px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.calculator:hover {
transform: translateY(-5px);
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}
.title {
font-size: clamp(1.8rem, 5vw, 2.5rem);
font-weight: 800;
color: white;
text-align: center;
margin-bottom: clamp(24px, 4vw, 32px);
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
letter-spacing: -0.02em;
}
.input-group {
margin-bottom: clamp(20px, 4vw, 24px);
}
.label {
display: block;
font-size: clamp(0.9rem, 2.5vw, 1.1rem);
font-weight: 600;
color: white;
margin-bottom: 8px;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.input {
width: 100%;
padding: clamp(12px, 3vw, 16px);
font-size: clamp(1rem, 3vw, 1.2rem);
font-weight: 600;
border: none;
border-radius: 16px;
background: rgba(255, 255, 255, 0.2);
color: white;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
transition: all 0.3s ease;
outline: none;
}
.input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
.input:focus {
background: rgba(255, 255, 255, 0.25);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.02);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.tip-buttons {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: clamp(8px, 2vw, 12px);
margin-bottom: clamp(20px, 4vw, 24px);
}
.tip-btn {
padding: clamp(10px, 2.5vw, 14px);
font-size: clamp(0.9rem, 2.5vw, 1.1rem);
font-weight: 700;
border: none;
border-radius: 12px;
background: rgba(255, 255, 255, 0.2);
color: white;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
cursor: pointer;
transition: all 0.3s ease;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.tip-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.tip-btn.active {
background: rgba(255, 255, 255, 0.4);
border-color: rgba(255, 255, 255, 0.6);
transform: scale(1.05);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.people-section {
display: flex;
align-items: center;
gap: clamp(8px, 2vw, 12px);
margin-bottom: clamp(16px, 3vw, 20px);
}
.people-btn {
width: clamp(36px, 8vw, 44px);
height: clamp(36px, 8vw, 44px);
border: none;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
color: white;
font-size: clamp(1.2rem, 3vw, 1.6rem);
font-weight: 700;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
}
.people-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.1);
}
.people-btn:active {
transform: scale(0.95);
}
.people-display {
flex: 1;
text-align: center;
font-size: clamp(1.1rem, 3vw, 1.4rem);
font-weight: 600;
color: white;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.results {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
border-radius: 20px;
padding: clamp(20px, 4vw, 28px);
border: 1px solid rgba(255, 255, 255, 0.2);
margin-top: clamp(16px, 3vw, 20px);
}
.result-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: clamp(12px, 3vw, 16px);
animation: slideIn 0.5s ease forwards;
opacity: 0;
transform: translateX(-20px);
}
.result-row:nth-child(1) { animation-delay: 0.1s; }
.result-row:nth-child(2) { animation-delay: 0.2s; }
.result-row:nth-child(3) { animation-delay: 0.3s; }
@keyframes slideIn {
to {
opacity: 1;
transform: translateX(0);
}
}
.result-label {
font-size: clamp(1rem, 2.8vw, 1.2rem);
font-weight: 600;
color: white;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.result-value {
font-size: clamp(1.4rem, 4vw, 2rem);
font-weight: 800;
color: white;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
letter-spacing: -0.02em;
}
.total {
border-top: 2px solid rgba(255, 255, 255, 0.3);
padding-top: clamp(12px, 3vw, 16px);
margin-top: clamp(8px, 2vw, 12px);
}
.total .result-value {
font-size: clamp(1.8rem, 5vw, 2.8rem);
background: linear-gradient(135deg, #fff, #f0f0f0);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.per-person {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(10px);
border-radius: 16px;
padding: clamp(16px, 3vw, 20px);
margin-top: clamp(12px, 2vw, 16px);
border: 1px solid rgba(255, 255, 255, 0.15);
}
/* Below the fold - Content sections */
.content-wrapper {
background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
background-size: 400% 400%;
animation: gradientShift 15s ease infinite;
padding: 60px 20px;
}
.content-container {
max-width: 1200px;
margin: 0 auto;
}
.content-section {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
border-radius: 20px;
padding: clamp(24px, 5vw, 40px);
margin-bottom: 40px;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.content-section:hover {
transform: translateY(-5px);
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}
.section-title {
font-size: clamp(1.5rem, 4vw, 2rem);
font-weight: 700;
color: white;
margin-bottom: 20px;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.section-text {
font-size: clamp(1rem, 2.5vw, 1.1rem);
line-height: 1.6;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 16px;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.faq-item {
margin-bottom: 24px;
background: rgba(255, 255, 255, 0.05);
border-radius: 12px;
padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease;
}
.faq-item:hover {
background: rgba(255, 255, 255, 0.08);
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
.faq-question {
font-size: clamp(1rem, 2.5vw, 1.2rem);
font-weight: 600;
color: white;
margin-bottom: 12px;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.faq-answer {
font-size: clamp(0.9rem, 2.2vw, 1rem);
line-height: 1.5;
color: rgba(255, 255, 255, 0.85);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.keyword-highlight {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
padding: 2px 6px;
border-radius: 4px;
font-weight: 600;
}
@media (max-width: 480px) {
.tip-buttons {
grid-template-columns: repeat(2, 1fr);
}
.people-section {
flex-direction: column;
gap: 12px;
}
.people-display {
order: -1;
}
}
</style>
</head>
<body>
<!-- Above the fold - Calculator Tool -->
<div class="calculator-section">
<div class="calculator">
<h1 class="title">Tip Calculator Online</h1>
<div class="input-group">
<label class="label" for="billAmount">Bill Amount</label>
<input type="number" id="billAmount" class="input" placeholder="$0.00" step="0.01" min="0">
</div>
<div class="input-group">
<label class="label">Tip Percentage</label>
<div class="tip-buttons">
<button class="tip-btn" data-tip="5">5%</button>
<button class="tip-btn" data-tip="7">7%</button>
<button class="tip-btn" data-tip="10">10%</button>
<button class="tip-btn" data-tip="15">15%</button>
<button class="tip-btn" data-tip="18">18%</button>
<button class="tip-btn" data-tip="20">20%</button>
<button class="tip-btn" data-tip="22">22%</button>
<button class="tip-btn" data-tip="25">25%</button>
<button class="tip-btn" data-tip="30">30%</button>
</div>
</div>
<div class="input-group">
<label class="label" for="customTip">Custom Tip %</label>
<input type="number" id="customTip" class="input" placeholder="0%" step="0.1" min="0" max="100">
</div>
<div class="people-section">
<button class="people-btn" onclick="changePeople(-1)">−</button>
<div class="people-display">
<span id="peopleCount">1</span> Person
</div>
<button class="people-btn" onclick="changePeople(1)">+</button>
</div>
<div class="results">
<div class="result-row">
<span class="result-label">Tip Amount:</span>
<span class="result-value" id="tipAmount">$0.00</span>
</div>
<div class="result-row total">
<span class="result-label">Total Amount:</span>
<span class="result-value" id="totalAmount">$0.00</span>
</div>
<div class="per-person" id="perPersonSection" style="display: none;">
<div class="result-row">
<span class="result-label">Per Person:</span>
<span class="result-value" id="perPersonAmount">$0.00</span>
</div>
</div>
</div>
</div>
</div>
<!-- Below the fold - SEO Content -->
<div class="content-wrapper">
<div class="content-container">
<!-- Overview Section -->
<div class="content-section">
<h2 class="section-title">What is a Tip Calculator Online?</h2>
<p class="section-text">
Our <span class="keyword-highlight">tip calculator online</span> is a free, easy-to-use tool designed to help you calculate the appropriate tip amount for various services. Whether you're dining at a restaurant, getting a haircut, or using any service where tipping is customary, this <span class="keyword-highlight">tip calculator</span> ensures you never have to do mental math again.
</p>
<p class="section-text">
The tool automatically calculates both the tip amount and total bill including tip, based on your bill total and desired tip percentage. You can choose from common tip percentages (15%, 18%, 20%, 22%, 25%, 30%) or enter a custom percentage. Additionally, our tip calculator can split the total among multiple people, making it perfect for group dining situations.
</p>
<p class="section-text">
In the United States, a 15% tip is typically the minimum expected for restaurant service, with 18-20% being standard for good service. Our <span class="keyword-highlight">tip calculator online</span> helps you quickly determine the right amount while ensuring fair compensation for service providers.
</p>
</div>
<!-- FAQ Section -->
<div class="content-section">
<h2 class="section-title">Frequently Asked Questions</h2>
<div class="faq-item">
<h3 class="faq-question">How do I use this tip calculator online?</h3>
<p class="faq-answer">Simply enter your bill amount, select or enter your desired tip percentage, and the calculator will instantly show your tip amount and total bill. You can also adjust the number of people to split the bill among multiple diners.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">What is the standard tip percentage in restaurants?</h3>
<p class="faq-answer">In the US, 15-20% is standard for restaurant service. 15% is typically the minimum for adequate service, 18-20% for good service, and 20%+ for exceptional service. Our tip calculator includes these common percentages for easy selection.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Should I tip on the pre-tax or post-tax amount?</h3>
<p class="faq-answer">It's generally acceptable to tip on either the pre-tax or post-tax amount. Many people prefer to tip on the pre-tax amount since tax isn't part of the service cost. Our tip calculator works with whatever amount you enter.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Can this tip calculator split bills among multiple people?</h3>
<p class="faq-answer">Yes! Our tip calculator includes a people counter feature. Simply adjust the number of people, and it will automatically calculate how much each person owes, including their share of the tip.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Is this tip calculator free to use?</h3>
<p class="faq-answer">Absolutely! Our tip calculator online is completely free to use with no registration required. You can use it as many times as you need on any device with internet access.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">What tip percentage should I use for different services?</h3>
<p class="faq-answer">Restaurant servers: 15-20%, Bartenders: 15-20% or $1-2 per drink, Hair stylists: 15-20%, Taxi/rideshare: 10-15%, Hotel housekeeping: $2-5 per night, Food delivery: 15-20%. Use our tip calculator to quickly calculate the appropriate amount.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Can I enter a custom tip percentage?</h3>
<p class="faq-answer">Yes! While our tip calculator provides common percentages (15%, 18%, 20%, 22%, 25%, 30%), you can also enter any custom percentage in the "Custom Tip %" field for situations requiring different amounts.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Does the tip calculator work on mobile devices?</h3>
<p class="faq-answer">Yes! Our tip calculator online is fully responsive and works perfectly on smartphones, tablets, and desktop computers. The interface adapts to your screen size for optimal usability on any device.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">How accurate are the calculations?</h3>
<p class="faq-answer">Our tip calculator provides precise calculations down to the cent. All amounts are properly rounded to the nearest penny and displayed in standard currency format for easy reading and payment.</p>
</div>
<div class="faq-item">
<h3 class="faq-question">Can I use this tip calculator for international tipping?</h3>
<p class="faq-answer">While our tip calculator works with any currency amount you enter, tipping customs vary significantly by country. This tool is optimized for US tipping standards, but you can adjust the percentages for local customs in other countries.</p>
</div>
</div>
</div>
</div>
<script>
let currentTip = 15;
let people = 1;
const billInput = document.getElementById('billAmount');
const customTipInput = document.getElementById('customTip');
const tipButtons = document.querySelectorAll('.tip-btn');
const tipAmountEl = document.getElementById('tipAmount');
const totalAmountEl = document.getElementById('totalAmount');
const perPersonAmountEl = document.getElementById('perPersonAmount');
const perPersonSection = document.getElementById('perPersonSection');
const peopleCountEl = document.getElementById('peopleCount');
// Set default tip button as active
document.querySelector('[data-tip="15"]').classList.add('active');
function formatCurrency(amount) {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(amount);
}
function calculateTip() {
const billAmount = parseFloat(billInput.value) || 0;
const tipPercentage = currentTip;
if (billAmount <= 0) {
tipAmountEl.textContent = '$0.00';
totalAmountEl.textContent = '$0.00';
perPersonAmountEl.textContent = '$0.00';
return;
}
const tipAmount = (billAmount * tipPercentage) / 100;
const totalAmount = billAmount + tipAmount;
const perPersonAmount = totalAmount / people;
// Animate the numbers
animateValue(tipAmountEl, parseFloat(tipAmountEl.textContent.replace(/[$,]/g, '') || 0), tipAmount);
animateValue(totalAmountEl, parseFloat(totalAmountEl.textContent.replace(/[$,]/g, '') || 0), totalAmount);
animateValue(perPersonAmountEl, parseFloat(perPersonAmountEl.textContent.replace(/[$,]/g, '') || 0), perPersonAmount);
// Show/hide per person section
if (people > 1) {
perPersonSection.style.display = 'block';
} else {
perPersonSection.style.display = 'none';
}
}
function animateValue(element, start, end) {
const duration = 600;
const startTime = performance.now();
function update(currentTime) {
const elapsed = currentTime - startTime;
const progress = Math.min(elapsed / duration, 1);
// Easing function
const easedProgress = 1 - Math.pow(1 - progress, 3);
const current = start + (end - start) * easedProgress;
element.textContent = formatCurrency(current);
if (progress < 1) {
requestAnimationFrame(update);
}
}
requestAnimationFrame(update);
}
function setTipPercentage(percentage) {
currentTip = percentage;
// Update button states
tipButtons.forEach(btn => btn.classList.remove('active'));
document.querySelector(`[data-tip="${percentage}"]`)?.classList.add('active');
// Clear custom tip if using preset
if (customTipInput.value && parseFloat(customTipInput.value) !== percentage) {
customTipInput.value = '';
}
calculateTip();
}
function changePeople(delta) {
people = Math.max(1, people + delta);
peopleCountEl.textContent = people;
document.querySelector('.people-display').innerHTML = `<span id="peopleCount">${people}</span> ${people === 1 ? 'Person' : 'People'}`;
calculateTip();
}
// Event listeners
billInput.addEventListener('input', calculateTip);
customTipInput.addEventListener('input', function() {
const customValue = parseFloat(this.value);
if (customValue >= 0) {
currentTip = customValue;
tipButtons.forEach(btn => btn.classList.remove('active'));
calculateTip();
}
});
tipButtons.forEach(button => {
button.addEventListener('click', function() {
const tipValue = parseFloat(this.dataset.tip);
customTipInput.value = '';
setTipPercentage(tipValue);
});
});
// Add focus animations
const inputs = document.querySelectorAll('.input');
inputs.forEach(input => {
input.addEventListener('focus', function() {
this.parentElement.style.transform = 'scale(1.02)';
});
input.addEventListener('blur', function() {
this.parentElement.style.transform = 'scale(1)';
});
});
// Initialize
calculateTip();
</script>
</body>
</html>