Tips on Incorporating Weather Icons into Your Weather App

I've integrated into my website to showcase weather icons. However, after adding the cdn link, the icons are not displaying correctly. The icon I'm trying to use has a class of "wi-wom-200" as listed on . This is essential because I am using openweathermap.com for my API. Any guidance on how I can successfully display this specific icon? Openweahtermap offers its own set of icons, but they are of very low resolution. Thank you.

/*
    Custom stylesheet for weather application
    */

body {
  background-image: url("../img/city_vector.jpg");
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin: 0 auto;
}

/* Background color overlay on top of background image */

.hero {
  position: absolute;
  min-height: 100vh;
  min-width: 100vw;
  top: 0;
  bottom: 0;
  background-color: rgba(31, 34, 118, 0.5);
  z-index: -5;
}

/* Navbar styling */

.navbar {
  background-color: rgb(69, 106, 171);
}

.navbar a {
  color: white;
  font-size: 25px;
}

/* Weather section design */

.weather {
  border: 1px solid white;
  height: 30rem;
  margin-top: 10rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  color: white;
}

.weather-head {
  height: 50%;
}

#weather-icon {
  height: 7rem;
  width: 7rem;
}

.weather-body {
  height: 50%;
  border-top: 1px solid white;
  padding-top: 0.5rem;
}

#description {
  font-size: 2rem;
}

#temperature {
  font-size: 7rem;
}

span {
  font-size: 3rem;
}
<!DOCTYPE html>
<html>

<head>
  <title>Weather App</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css">
  <link rel="stylesheet" type="text/css" href="./css/style.css">
</head>

<body>
  <div class="hero">
    <!-- navigation bar -->
    <nav class="navbar">
      <a class="navbar-brand" href="#">
        <i class="fa fa-sun-o" aria-hidden="true"></i>
        <strong>Local</strong>Weather
      </a>
    </nav>

    <!-- weather section  -->
    <div class="container">
      <div class="row">
        <div id="" class="col-8 mx-auto weather">
          <div class="weather-head">
            <h2 id="location" class="text-center"></h2>
            <div class="row">
              <div id="description" class="description col-6 text-center">
                <i class="wi wi-wom-200"></i> Thunderstorm
              </div>
              <div id="temperature" class="col-6 text-center">
              </div>
            </div>
            <div class="weather-body">
              <div class="row">
                <div class="humidity col-4">
                  <div class="lead text-center">Humidity</div>
                </div>
                <div class="wind col-4">
                  <div class="lead text-center">Wind Speed</div>
                </div>
                <div class="wind-degree col-4">
                  <div class="lead text-center">Wind Direction</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>

Answer №1

Ensure that you have added the icons CDN link below:

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css">

After adding the link, use the wi-owm-200 class for the icon.

body {
  background-image: url("../img/city_vector.jpg");
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin: 0 auto;
}

.hero {
  position: absolute;
  min-height: 100vh;
  min-width: 100vw;
  top: 0;
  bottom: 0;
  background-color: rgba(31, 34, 118, 0.5);
  z-index: -5;
}

.navbar {
  background-color: rgb(69, 106, 171);
}

.navbar a {
  color: white;
  font-size: 25px;
}

.weather {
  border: 1px solid white;
  height: 30rem;
  margin-top: 10rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  color: white;
}

.weather-head {
  height: 50%;
}

#weather-icon {
  height: 7rem;
  width: 7rem;
}

.weather-body {
  height: 50%;
  border-top: 1px solid white;
  padding-top: 0.5rem;
}

#description {
  font-size: 2rem;
}

#temperature {
  font-size: 7rem;
}

span {
  font-size: 3rem;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css">
<div class="hero">
  <nav class="navbar">
    <a class="navbar-brand" href="#">
      <i class="fa fa-sun-o" aria-hidden="true"></i>
      <strong>Local</strong>Weather
    </a>
  </nav>
  <div class="container">
    <div class="row">
      <div id="" class="col-8 mx-auto weather">
        <div class="weather-head">
          <h2 id="location" class="text-center"></h2>
          <div class="row">
            <div id="description" class="description col-6 text-center">
              <i class="wi wi-owm-200"></i> Thunderstorm
            </div>
            <div id="temperature" class="col-6 text-center">
            </div>
          </div>
          <div class="weather-body">
            <div class="row">
              <div class="humidity col-4">
                <div class="lead text-center">Humidity</div>
              </div>
              <div class="wind col-4">
                <div class="lead text-center">Wind Speed</div>
              </div>
              <div class="wind-degree col-4">
                <div class="lead text-center">Wind Direction</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with Flexbox Layout - Flipping Card

As a newcomer to web development, my first project is a fan-page dedicated to Metallica. Here's the link to my project on Github. I'm currently facing an issue with the flex-box layout in the "Discography" section of the page. You can view the ...

Tips for removing the default CakePHP CSS without deleting it from the default.ctp file

Currently, I am looking to enhance the design of my webpages individually using Bootstrap. The specific page I am focusing on currently utilizes the cake.generic.css stylesheet, but I am aiming to eliminate it from this particular page. Is there a way for ...

Adjust the width of an anchor tag

I have been experimenting with different solutions and unfortunately, I have not been successful in resolving the issue at hand. While working on a WordPress website, I encountered some challenges. Despite having some knowledge in this area, I am struggli ...

Can a javascript code for "Infinite Scroll" be created to manage the back button?

Head over to this website: Experiment with the infinite scroll feature. You may notice that when you click a link and then press "back", there are some glitches. Therefore, I am considering developing my own version of an Infinite Scroll functionality. ...

Padding provides varying padding for the top and bottom sections

html { font-size : 10px; } body { text-align : center; color : #9da8c1; font-family : sans-serif; background : #013f81; } h1 { font-size: 4rem; } #img-div { background : #2a5590; width : 600px; margin : 0 auto; pad ...

CSS has detected an invalid value for the property across all components. Please

Need help reverting the style of a child element back to default and receiving an error message saying "Invalid Property Value". HTML: <div class="dropdown locale-selector"> <button class="btn btn-secondary " type="button" id="dropdownMenuBut ...

Is there a way to detect changes in screen orientation on any mobile device?

Currently, I have a website that adapts its display based on whether the mobile device is in portrait or landscape orientation. The code I am using works on some devices, but on others, the orientation is flipped and the wrong page is displayed. Although t ...

What is the best way to use two buttons to sort the table's column type?

I need to sort the type column. There will be two buttons, one to filter aquatic animals and the other to filter all animals except aquatic ones. <button type="button" onclick="Aquatic()">Aquatic</button> <button type="button" onclick ...

The storing of data in an HTML form input

Within my submission form, there are five distinct inputs that users can enter and submit. Currently, the entered data is being written to a .txt file successfully. Nevertheless, the objective is to organize and display the information in an easily readabl ...

Show the value of a query in a label within the body of an HTML document

I am trying to showcase the result of my query in a label within the HTML body. I have successfully counted the records and now aim to display the count result in the label. Below is my code snippet <div class="huge" > <label class="pull-right" ...

What is the best way to check for a matching array value in my menu list and apply a corresponding class tag to it?

I need a way to dynamically add a class to tags that match specific array values. My menu list consists of 150 items, and I want to add a class to the tag whose text matches an element in the array. <ul class="nav main" id="tabs"&g ...

Identify the current slide or div within a jQuery slideshow

I am currently facing an issue with my slide show that is composed of divs, each containing a picture and some html controls. The problem arises when clicking on a control in a slide other than the first one - it only updates the first slide. The only thin ...

Retrieve all data points if both latitude and longitude are present in the XML dataset

XML data to retrieve details <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results> <result> <Country_Code>IN</Country_Code> <Country_Name>India</Country_Name> <Region_Nam ...

CSS3 Flexbox creating excess space on the right side

My website currently has a 4 column layout with each div set to a width of 25%, which is resulting in empty space on the right side. How can I adjust this layout to fill the entire screen width? https://i.sstatic.net/d0cJ6.png I have created a flexbo ...

Interact with Database using PHP and AJAX/JQuery

I am looking for assistance on how to display user data without refreshing the page. In my form, when I input a user's ID, I want a div to show up with the corresponding user information. Can someone provide guidance on how to achieve this? Form Exam ...

Style your index with a Wordpress plugin

I've been attempting to modify a plugin's stylesheet, but I'm having trouble locating the CSS file that contains the necessary styles. Despite Chrome's developer tool indicating that it is styled directly on the index site, I have searc ...

The sidebar is refusing to stick. I've exhausted all resources on Stack Overflow trying to fix it

Having issues with the sticky sidebar on my website, I've tried solutions from various Stack Overflow threads: Understanding "position: sticky;" property Fix for position:sticky not working Implementing sticky sidebar when scrolling down/up The is ...

Using JQuery to locate radio buttons that have been selected based on a variable

In my JavaScript code, I have created a variable called "thisRadio" to represent a dynamically generated div containing multiple radio buttons. Currently, one of these radio buttons may be checked and my goal is to find the checked radio button within this ...

Looking to update a component in Vue 3 and Laravel 9 without the need to reload the entire webpage

Looking for a solution to refresh the header component upon clicking the logout button, in order to display the login and register options without refreshing the entire page. Any effective suggestions on how to achieve this are greatly appreciated. The l ...

Why does it seem like I can only see one of my two modals?

I'm experiencing an issue with displaying two modals on the same page. The first modal appears correctly, but the second one does not show up. Only the dark "opacity" screen is displayed, without the modal itself. I've tried various solutions fro ...