<!-- =========================
PREMIUM DOG AGE CALCULATOR
WordPress Gutenberg Ready
Pure HTML + CSS + JavaScript
========================= -->
<div id="dog-age-app">
<!-- HERO SECTION -->
<section class="dog-hero">
<div class="hero-content">
<div class="hero-badge">🐶 Premium Veterinary Dog Age Calculator</div>
<h1>Dog Age Calculator</h1>
<p>
Convert dog years to human years using modern veterinary research.
Discover your dog’s life stage, accurate age equivalent, and fun insights instantly.
</p>
<div class="hero-stats">
<div class="stat-card">
<span>🐾</span>
<strong>Smart Formulas</strong>
</div>
<div class="stat-card">
<span>🦴</span>
<strong>Breed Size Based</strong>
</div>
<div class="stat-card">
<span>💖</span>
<strong>Vet Inspired</strong>
</div>
</div>
</div>
<div class="hero-illustration">
<div class="dog-circle">
🐕
</div>
</div>
</section>
<!-- MAIN CALCULATOR -->
<section class="calculator-wrapper">
<div class="calculator-card">
<div class="card-header">
<h2>🐾 Calculate Dog Age</h2>
<p>Modern dashboard-style dog age converter</p>
</div>
<!-- Conversion Type -->
<div class="field-group">
<label>Conversion Type</label>
<div class="toggle-buttons">
<button class="toggle-btn active" data-mode="dogToHuman">
🐶 Dog → Human
</button>
<button class="toggle-btn" data-mode="humanToDog">
👨 Human → Dog
</button>
</div>
</div>
<!-- Years + Months -->
<div class="grid-2">
<div class="field-group">
<label>Years</label>
<input type="number" id="years" placeholder="Enter years" min="0">
</div>
<div class="field-group">
<label>Months</label>
<input type="number" id="months" placeholder="Enter months" min="0" max="11">
</div>
</div>
<!-- Dog Size -->
<div class="field-group">
<label>Dog Size</label>
<div class="size-selector">
<div class="size-card active" data-size="small">
🐕🦺
<span>Small</span>
<small>Longer lifespan</small>
</div>
<div class="size-card" data-size="medium">
🐕
<span>Medium</span>
<small>Balanced aging</small>
</div>
<div class="size-card" data-size="large">
🦮
<span>Large</span>
<small>Faster aging</small>
</div>
</div>
</div>
<button id="calculateBtn">
✨ Calculate Dog Age
</button>
</div>
<!-- RESULT CARD -->
<div class="result-card" id="resultCard">
<div class="result-top">
<div class="result-icon">🐾</div>
<div>
<h3>Age Result</h3>
<p>Your personalized dog age analysis</p>
</div>
</div>
<div class="result-main">
<div class="result-number" id="resultNumber">0</div>
<div class="result-label" id="resultLabel">Human Years</div>
</div>
<div class="life-stage" id="lifeStage">
Puppy
</div>
<p class="personalized-message" id="personalizedMessage">
Your furry friend is full of playful puppy energy! 🐶
</p>
</div>
</section>
<!-- LIFE STAGES -->
<section class="life-stages-section">
<div class="section-title">
<h2>🐾 Dog Life Stages</h2>
<p>Understand your dog’s growth journey</p>
</div>
<div class="life-stage-grid">
<div class="stage-card puppy">
<div class="emoji">🐶</div>
<h3>Puppy</h3>
<p>0 - 1.5 human years equivalent</p>
</div>
<div class="stage-card young">
<div class="emoji">🐕</div>
<h3>Young Adult</h3>
<p>Energetic and playful years</p>
</div>
<div class="stage-card mature">
<div class="emoji">🦮</div>
<h3>Mature Adult</h3>
<p>Wise, balanced and calm stage</p>
</div>
<div class="stage-card senior">
<div class="emoji">🐕🦺</div>
<h3>Senior</h3>
<p>Extra love and care needed</p>
</div>
</div>
</section>
<!-- AGE CHART -->
<section class="chart-section">
<div class="section-title">
<h2>📊 Dog Age Conversion Chart</h2>
<p>Quick dog years to human years reference table</p>
</div>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Dog Years</th>
<th>Small Breed</th>
<th>Medium Breed</th>
<th>Large Breed</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>15</td>
<td>15</td>
<td>14</td>
</tr>
<tr>
<td>2</td>
<td>24</td>
<td>24</td>
<td>22</td>
</tr>
<tr>
<td>5</td>
<td>36</td>
<td>40</td>
<td>45</td>
</tr>
<tr>
<td>8</td>
<td>48</td>
<td>55</td>
<td>64</td>
</tr>
<tr>
<td>10</td>
<td>56</td>
<td>66</td>
<td>79</td>
</tr>
<tr>
<td>15</td>
<td>76</td>
<td>93</td>
<td>115</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- DOG FACTS -->
<section class="facts-section">
<div class="section-title">
<h2>🦴 Fun Dog Facts</h2>
<p>Interesting insights about dogs and aging</p>
</div>
<div class="facts-grid">
<div class="fact-card">
<span>🐾</span>
<p>Dogs age rapidly during their first two years of life.</p>
</div>
<div class="fact-card">
<span>💖</span>
<p>Small dogs usually live longer than giant breeds.</p>
</div>
<div class="fact-card">
<span>🧠</span>
<p>Dogs can understand over 100 human words and gestures.</p>
</div>
<div class="fact-card">
<span>🏃</span>
<p>Regular exercise can slow down aging in dogs.</p>
</div>
</div>
</section>
</div>
<style>
/* =========================
GLOBAL STYLES
========================= */
#dog-age-app *{
box-sizing:border-box;
}
#dog-age-app{
font-family:Inter,Segoe UI,sans-serif;
color:#222;
line-height:1.6;
background:
linear-gradient(180deg,#fff7f3 0%,#f7fbff 100%);
padding:30px 15px;
}
/* =========================
HERO
========================= */
.dog-hero{
max-width:1500px;
margin:auto;
display:grid;
grid-template-columns:1.2fr .8fr;
gap:40px;
align-items:center;
padding:50px;
border-radius:35px;
background:
linear-gradient(135deg,#ff7b54,#ffb26b);
color:white;
overflow:hidden;
position:relative;
box-shadow:
0 20px 60px rgba(255,123,84,.25);
}
.hero-badge{
display:inline-block;
background:rgba(255,255,255,.18);
padding:10px 18px;
border-radius:100px;
margin-bottom:20px;
backdrop-filter:blur(10px);
font-weight:600;
}
.dog-hero h1{
font-size:60px;
line-height:1.1;
margin:0 0 20px;
}
.dog-hero p{
font-size:18px;
max-width:600px;
}
.hero-stats{
display:flex;
gap:15px;
margin-top:35px;
flex-wrap:wrap;
}
.stat-card{
background:rgba(255,255,255,.18);
padding:15px 20px;
border-radius:20px;
backdrop-filter:blur(10px);
display:flex;
gap:10px;
align-items:center;
font-weight:600;
}
.hero-illustration{
display:flex;
justify-content:center;
align-items:center;
}
.dog-circle{
width:260px;
height:260px;
border-radius:50%;
background:
rgba(255,255,255,.15);
display:flex;
align-items:center;
justify-content:center;
font-size:120px;
backdrop-filter:blur(10px);
animation:floatDog 4s ease-in-out infinite;
}
@keyframes floatDog{
0%{transform:translateY(0px);}
50%{transform:translateY(-15px);}
100%{transform:translateY(0px);}
}
/* =========================
CALCULATOR
========================= */
.calculator-wrapper{
max-width:1200px;
margin:50px auto;
display:grid;
grid-template-columns:1fr 1fr;
gap:30px;
}
.calculator-card,
.result-card{
background:rgba(255,255,255,.72);
border:1px solid rgba(255,255,255,.6);
backdrop-filter:blur(18px);
border-radius:30px;
padding:35px;
box-shadow:
0 15px 40px rgba(0,0,0,.08);
}
.card-header h2{
margin:0;
font-size:34px;
}
.card-header p{
color:#666;
margin-bottom:30px;
}
.field-group{
margin-bottom:25px;
}
.field-group label{
display:block;
font-weight:700;
margin-bottom:12px;
}
.grid-2{
display:grid;
grid-template-columns:1fr 1fr;
gap:20px;
}
input{
width:100%;
padding:18px;
border:none;
border-radius:18px;
background:#fff;
font-size:16px;
box-shadow:
inset 0 0 0 1px rgba(0,0,0,.05);
transition:.3s;
}
input:focus{
outline:none;
transform:translateY(-2px);
box-shadow:
0 0 0 4px rgba(79,156,249,.15);
}
/* TOGGLE */
.toggle-buttons{
display:flex;
gap:12px;
}
.toggle-btn{
flex:1;
padding:16px;
border:none;
border-radius:18px;
background:#eef4ff;
cursor:pointer;
font-weight:700;
transition:.3s;
}
.toggle-btn.active{
background:
linear-gradient(135deg,#4f9cf9,#8b5cf6);
color:white;
box-shadow:
0 10px 25px rgba(79,156,249,.25);
}
/* SIZE CARDS */
.size-selector{
display:grid;
grid-template-columns:repeat(3,1fr);
gap:15px;
}
.size-card{
background:#fff;
padding:20px;
border-radius:22px;
text-align:center;
cursor:pointer;
transition:.3s;
border:2px solid transparent;
box-shadow:
0 8px 20px rgba(0,0,0,.05);
}
.size-card:hover{
transform:translateY(-5px);
}
.size-card.active{
border-color:#ff7b54;
background:
linear-gradient(135deg,#fff6f2,#fff);
}
.size-card span{
display:block;
font-size:20px;
font-weight:700;
margin-top:8px;
}
.size-card small{
color:#777;
}
#calculateBtn{
width:100%;
border:none;
padding:20px;
border-radius:20px;
background:
linear-gradient(135deg,#ff7b54,#ffb26b);
color:white;
font-size:18px;
font-weight:700;
cursor:pointer;
transition:.35s;
box-shadow:
0 15px 35px rgba(255,123,84,.35);
}
#calculateBtn:hover{
transform:translateY(-4px) scale(1.01);
}
/* =========================
RESULT
========================= */
.result-card{
position:relative;
overflow:hidden;
}
.result-card:before{
content:"🐾";
position:absolute;
right:-10px;
top:-20px;
font-size:180px;
opacity:.05;
}
.result-top{
display:flex;
align-items:center;
gap:18px;
}
.result-icon{
width:80px;
height:80px;
border-radius:22px;
background:
linear-gradient(135deg,#4f9cf9,#8b5cf6);
display:flex;
align-items:center;
justify-content:center;
color:white;
font-size:36px;
}
.result-main{
margin:35px 0;
}
.result-number{
font-size:80px;
font-weight:900;
line-height:1;
background:
linear-gradient(135deg,#ff7b54,#8b5cf6);
-webkit-background-clip:text;
-webkit-text-fill-color:transparent;
}
.result-label{
font-size:20px;
color:#666;
}
.life-stage{
display:inline-block;
padding:12px 20px;
border-radius:100px;
background:
linear-gradient(135deg,#ffb26b,#ff7b54);
color:white;
font-weight:700;
margin-bottom:20px;
}
.personalized-message{
font-size:18px;
color:#555;
}
/* =========================
SECTIONS
========================= */
.section-title{
text-align:center;
margin-bottom:40px;
}
.section-title h2{
font-size:42px;
margin-bottom:10px;
}
.section-title p{
color:#666;
}
.life-stages-section,
.chart-section,
.facts-section{
max-width:1200px;
margin:90px auto;
}
/* LIFE STAGES */
.life-stage-grid{
display:grid;
grid-template-columns:repeat(4,1fr);
gap:25px;
}
.stage-card{
padding:35px 25px;
border-radius:28px;
text-align:center;
color:white;
transition:.35s;
}
.stage-card:hover{
transform:translateY(-10px);
}
.stage-card .emoji{
font-size:55px;
margin-bottom:15px;
}
.puppy{
background:
linear-gradient(135deg,#ff7b54,#ffb26b);
}
.young{
background:
linear-gradient(135deg,#4f9cf9,#6ab7ff);
}
.mature{
background:
linear-gradient(135deg,#8b5cf6,#a78bfa);
}
.senior{
background:
linear-gradient(135deg,#f59e0b,#fbbf24);
}
/* TABLE */
.table-wrapper{
overflow:auto;
background:white;
border-radius:28px;
box-shadow:
0 15px 35px rgba(0,0,0,.07);
}
table{
width:100%;
border-collapse:collapse;
}
thead{
background:
linear-gradient(135deg,#4f9cf9,#8b5cf6);
color:white;
}
th,td{
padding:20px;
text-align:center;
}
tbody tr:nth-child(even){
background:#f9fbff;
}
/* FACTS */
.facts-grid{
display:grid;
grid-template-columns:repeat(4,1fr);
gap:20px;
}
.fact-card{
background:white;
padding:30px;
border-radius:24px;
text-align:center;
box-shadow:
0 10px 30px rgba(0,0,0,.06);
transition:.35s;
}
.fact-card:hover{
transform:translateY(-8px);
}
.fact-card span{
font-size:45px;
display:block;
margin-bottom:15px;
}
/* =========================
RESPONSIVE
========================= */
@media(max-width:991px){
.dog-hero{
grid-template-columns:1fr;
text-align:center;
}
.calculator-wrapper{
grid-template-columns:1fr;
}
.life-stage-grid,
.facts-grid{
grid-template-columns:1fr 1fr;
}
.dog-hero h1{
font-size:44px;
}
}
@media(max-width:767px){
.dog-hero{
padding:30px 20px;
}
.calculator-card,
.result-card{
padding:25px;
}
.grid-2,
.size-selector,
.life-stage-grid,
.facts-grid{
grid-template-columns:1fr;
}
.toggle-buttons{
flex-direction:column;
}
.dog-circle{
width:180px;
height:180px;
font-size:80px;
}
.result-number{
font-size:60px;
}
.section-title h2{
font-size:32px;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function(){
let mode = "dogToHuman";
let size = "small";
const toggleButtons = document.querySelectorAll(".toggle-btn");
const sizeCards = document.querySelectorAll(".size-card");
const yearsInput = document.getElementById("years");
const monthsInput = document.getElementById("months");
const resultNumber = document.getElementById("resultNumber");
const resultLabel = document.getElementById("resultLabel");
const lifeStage = document.getElementById("lifeStage");
const personalizedMessage = document.getElementById("personalizedMessage");
/* TOGGLE MODE */
toggleButtons.forEach(btn => {
btn.addEventListener("click", function(){
toggleButtons.forEach(b => b.classList.remove("active"));
this.classList.add("active");
mode = this.dataset.mode;
});
});
/* SIZE SELECT */
sizeCards.forEach(card => {
card.addEventListener("click", function(){
sizeCards.forEach(c => c.classList.remove("active"));
this.classList.add("active");
size = this.dataset.size;
});
});
/* CALCULATE */
document.getElementById("calculateBtn").addEventListener("click", calculateAge);
function calculateAge(){
const years = parseFloat(yearsInput.value) || 0;
const months = parseFloat(monthsInput.value) || 0;
const totalYears = years + (months / 12);
if(totalYears <= 0){
alert("Please enter a valid age.");
return;
}
let result = 0;
/* DOG TO HUMAN */
if(mode === "dogToHuman"){
result = dogToHuman(totalYears, size);
resultLabel.innerHTML = "Human Years Equivalent";
}
/* HUMAN TO DOG */
else{
result = humanToDog(totalYears, size);
resultLabel.innerHTML = "Dog Years Equivalent";
}
result = Math.round(result);
resultNumber.innerHTML = result;
const stage = getLifeStage(result);
lifeStage.innerHTML = stage;
personalizedMessage.innerHTML = getMessage(stage);
}
/* DOG TO HUMAN */
function dogToHuman(age, size){
let humanAge;
if(age <= 1){
humanAge = age * 15;
}
else if(age <= 2){
humanAge = 15 + ((age - 1) * 9);
}
else{
let multiplier = 4.5;
if(size === "medium") multiplier = 5.5;
if(size === "large") multiplier = 7;
humanAge = 24 + ((age - 2) * multiplier);
}
return humanAge;
}
/* HUMAN TO DOG */
function humanToDog(age, size){
let dogAge;
if(age <= 15){
dogAge = age / 15;
}
else if(age <= 24){
dogAge = 1 + ((age - 15) / 9);
}
else{
let divisor = 4.5;
if(size === "medium") divisor = 5.5;
if(size === "large") divisor = 7;
dogAge = 2 + ((age - 24) / divisor);
}
return dogAge;
}
/* LIFE STAGES */
function getLifeStage(humanAge){
if(humanAge < 18){
return "🐶 Puppy";
}
else if(humanAge < 40){
return "🐕 Young Adult";
}
else if(humanAge < 65){
return "🦮 Mature Adult";
}
else{
return "🐕🦺 Senior";
}
}
/* MESSAGES */
function getMessage(stage){
if(stage.includes("Puppy")){
return "Your furry friend is full of playful puppy energy and curiosity! 🐾";
}
if(stage.includes("Young")){
return "Your dog is in the prime of life — energetic, happy, and active! 💖";
}
if(stage.includes("Mature")){
return "Your loyal companion is mature, wise, and wonderfully balanced. 🦴";
}
return "Your senior dog deserves extra love, comfort, and gentle care. 🐕🦺";
}
});
</script>