In this blog we will create a simple webdesign to display the current weather information. We will be using the openweather’s free api for this tutorial. Openweather is a weather forcasting company. They have lots of weather services. They also have thier oen app and also been providing the weather data to other apps like of google and other third party apps.

I will provide you all the links helpful for this tutorial. Now lets get started with our tutorial. The tutorial will be going as regural as we used to do. First we create our HTML. After that we code our javascripts and finally we give them CSS.

  1. Creating HTML
<!DOCTYPE html>
  <title>Weather App</title>
  <link href="" rel="stylesheet">
  <link href="" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="css/style.css">
<div class="container">
  <div class="card">
      <h2><i class="fa fa-map-marker"></i> <span id="location"></span></h2>
      <h6 id="weather"></h6>
      <h4><span id="temp"></span><sup>o</sup>C</h4>
      <img id="icon" src="">
      <button onClick="window.location.reload();" class="refresh"><i class="fa fa-refresh"></i></button>

2. Now Javascript

<script src="" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
<script type="text/javascript">
link = "";
var request = new XMLHttpRequest();'GET',link,true);
request.onload = function(){
 var obj = JSON.parse(this.response);
 document.getElementById('weather').innerHTML =[0].description;
 document.getElementById('location').innerHTML =;
 document.getElementById('temp').innerHTML = obj.main.temp - 273.15;
 document.getElementById('icon').src = "" +[0].icon + ".png";

 if (request.status >= 200 && request.status < 400) {
 var temp = obj.main.temp;
  console.log("The city doesn't exist! Kindly check");

3. Adding css

	margin: 0;
	padding: 0;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: 'Poppins', sans-seriff;
	color: #fff;
	background:  #343434;
.container {
    width: 26%;
.card {
    border-radius: 50px;
    background: #343434;
    box-shadow: 5px 5px 10px #191b1b, -5px -5px 10px #595959;
    padding: 3%;
    text-align: center;
.card h4 {
    font-size: 4rem;
    font-weight: 400;
    margin: 1rem 0;
img#icon {
    width: 20%;
	text-transform: capitalize;
button.refresh {
    display: block;
    width: 100px;
    margin: 10px auto;
    border: 0;
    background: transparent;
    color: #9c9c9d;
    font-size: 30px;
    height: 100px;
    border-radius: 50%;
    box-shadow: 10px 4px 18px #252525, 5px 5px 18px #4a4a4a;
    transition: 0.3s;
	box-shadow: inset 10px 4px 18px #252525, inset 5px 5px 18px #4a4a4a;

You can find the full code in my github here. Good luck and create your own weather webdesign. You need to get signed up and have your own free api key fromĀ here.

Create you HTML as you wanna make how it renders in the browser. Mine looks like as above in picture. In this tutorial we will be dealing with the api. So we will be geting some datas from the server which in this case if from the openweathermap server. We will deal with the JSON data arriving from the js request.

var request = new XMLHttpRequest();‘GET’,link,true);

We will request the data as above using the XMLHttpRequest function. We will GET request along with sending the api link.

link=”{city name}&appid={your api key}”

The link will look like this for the api where we need the api key and the name of the place

to find weather data.

Get the video tutorial from here: