A beautiful, responsive weather application that provides real-time weather information for any location worldwide.
- 🌍 Global Coverage - Get weather data for any city or region worldwide
- 🎨 Beautiful UI - Clean, modern interface with gradient backgrounds
- 📱 Responsive Design - Works perfectly on desktop, tablet, and mobile devices
- ⚡ Real-time Data - Powered by WeatherAPI for accurate, up-to-date information
- 🔍 Smart Search - Enter locations in various formats (city, state, country)
- ❌ Error Handling - User-friendly error messages for invalid locations
- A modern web browser
- Internet connection for API calls
- Clone or download the project files
- Open
index.htmlin your web browser - Start searching for weather information!
# If using git
git clone <your-repo-url>
cd weather-app
open index.html- Enter a location in the search box (e.g., "London", "New York", "Bihar")
- Click the "Get Weather" button or press Enter
- View the current temperature and location details instantly
- City names:
London,Tokyo,Mumbai - States/Regions:
California,Bihar,Texas - Countries:
India,France,Australia - Combinations:
Paris, France,Mumbai, India
- HTML5 - Structure and semantic markup
- CSS3 - Styling with modern features (flexbox, gradients, shadows)
- Vanilla JavaScript - API integration and DOM manipulation
- WeatherAPI - Real-time weather data provider
This app uses the WeatherAPI service:
- Endpoint:
http://api.weatherapi.com/v1/current.json - Features: Current weather conditions, location details
- Rate Limit: Free tier includes sufficient requests for personal use
- ✅ Chrome (recommended)
- ✅ Firefox
- ✅ Safari
- ✅ Edge
- ✅ Mobile browsers
- Gradient Background: Soothing blue-to-cyan gradient
- Glass Effect: Clean white container with subtle shadows
- Typography: Clear, readable Arial font family
- Color Scheme: Professional blue (#0077ff) with hover effects
- Flexible Layout: Centers content on all screen sizes
- Scalable Input: 80% width input field for optimal mobile experience
- Touch-Friendly: Large buttons and clickable areas
Update the API key in the JavaScript section:
const apiKey = "YOUR_NEW_API_KEY_HERE";Key CSS classes you can customize:
.weather-container- Main app container.result- Weather display styling.error- Error message appearancebody- Background gradient
The modular structure makes it easy to add:
- Weather forecasts
- Additional weather parameters
- Geolocation detection
- Weather icons
- Temperature unit conversion
The app gracefully handles various error scenarios:
- Empty Input: "Please enter a location."
- Invalid Location: "Could not fetch weather. Please try a valid location."
- Network Issues: Automatic retry suggestions
- API Errors: User-friendly error messages
- HTTPS Ready: Can be easily converted to use HTTPS endpoints
- No Data Storage: No personal information is stored locally
- API Key Protection: Consider environment variables for production
- Lightweight: Minimal dependencies, fast loading
- Efficient: Single API call per search
- Optimized: Clean, semantic HTML and efficient CSS
Want to improve the Weather App? Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Weather icons and animations
- Extended forecast (7-day, hourly)
- Geolocation support
- Temperature unit toggle (°C/°F)
- Weather alerts and warnings
- Dark/light theme toggle
- WeatherAPI - For providing reliable weather data
- CSS Gradient - For the beautiful background inspiration
- MDN Web Docs - For excellent web development resources
Made with ❤️ for weather enthusiasts worldwide