A responsive Body Mass Index (BMI) Calculator built with HTML, CSS, and JavaScript that validates inputs, calculates BMI, and displays results with a dynamic color-coded health meter.
📸 Screenshots :
- 📏 Input Validation - Validates height (cm) and weight (kg) inputs
- 🧮 Accurate BMI Calculation - Uses standard BMI formula with proper unit conversion
- 🎨 Visual Health Meter - Animated progress bar that changes color based on BMI category
- 📱 Responsive Design - Works seamlessly on desktop and mobile devices
- 🎯 Color-Coded Results - Different colors for Underweight, Normal, and Overweight categories
- ⚡ Real-time Feedback - Instant calculation and visual representation
- 🖥️ Clean UI - Modern design with smooth animations and hover effects
| Category | BMI Range | Color | Meter Fill |
|---|---|---|---|
| Underweight | < 18.6 | 🟠 Orange | 30% |
| Normal | 18.6 - 24.9 | 🟢 Green | 60% |
| Overweight | > 24.9 | 🔴 Red | 90% |
- HTML5 - Semantic markup and structure
- CSS3 - Styling, animations, and responsive design
- JavaScript (ES6+) - Logic, calculations, and DOM manipulation
Health-Meter/
├── index.html # Main HTML structure
├── style.css # Styling and animations
├── script.js # BMI calculation logic
└── README.md # Project documentation
git clone https://github.com/JwelSrivastava/Health-Meter.git
cd Health-Meter- Click the green "Code" button on GitHub
- Select "Download ZIP"
- Extract the files to your desired location
- Open
index.htmlin your web browser - Enter your height in centimeters
- Enter your weight in kilograms
- Click "Calculate" to see your BMI result and health meter
- Input Collection - User enters height (cm) and weight (kg)
- Validation - JavaScript validates inputs for positive numbers
- BMI Calculation - Formula:
BMI = weight(kg) / (height(m))² - Categorization - Result is categorized based on standard BMI ranges
- Visual Display - Health meter animates to show BMI category with appropriate color
if (isNaN(height) || height <= 0) {
results.innerHTML = `Please give a valid height!`;
}const bmi = (weight / ((height * height) / 10000)).toFixed(2);- Animated width transition based on BMI category
- Color changes (Orange → Green → Red)
- Smooth CSS transitions for better UX
- Mobile-friendly layout
- Flexible container that adapts to screen size
- Touch-friendly button design
- Readable fonts and appropriate sizing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Imperial units support (feet/inches, pounds)
- BMI history tracking with local storage
- Additional health metrics (ideal weight range)
- Print/share BMI results
- Dark mode toggle
- Multiple language support
This project is open source and available under the MIT License.
Jwel Srivastava
- GitHub: @JwelSrivastava
- Project: Health-Meter
- BMI calculation based on WHO standards
- Design inspired by modern health applications
- Icons and styling following current web design trends
⭐ Star this repository if you found it helpful!
📧 Made with ❤️ by Jwel Srivastava | Syntax Surfer.