输入城市名搜索查询天气预报效果代码

代码语言:html

所属分类:其他

代码描述:输入城市名搜索查询天气预报效果代码

代码标签: 输入 城市名 搜索 查询 天气 预报

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

 
<meta charset="UTF-8">
 

 
 
 
 
<style>
html {
  width: 100%;
  height: 100vh;
  font-family: "Poppins", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  background: #fffef4;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #8b8b8b;
  transition: all 1s;
}

.weather__container {
  width: 500px;
  height: 230px;
  background: #fff;
  border-radius: 20px;
  position: relative;
  box-shadow: 0 0 20px 10px rgba(0, 0, 0, 0.05);
}
.weather__container #units__toggle {
  position: absolute;
  top: 5%;
  right: 5%;
  display: flex;
  z-index: 10;
}
.weather__container #units__toggle #celsius,
.weather__container #units__toggle #fahrenheit {
  margin-right: 10px;
  padding: 8px 11px;
  cursor: pointer;
  border: none;
  background: #fff;
  border-radius: 100px;
}
.weather__container #units__toggle .active {
  color: #fff;
  background: #89d3c5 !important;
  pointer-events: none;
}
.weather__container #weather__icon {
  position: absolute;
  top: 50%;
  left: -10%;
  transform: translate(0%, -50%);
  width: 180px;
  height: 180px;
}
.weather__container #weather__icon svg {
  width: 100%;
  overflow: visible;
}
.weather__container #weather__icon #clear-sky,
.weather__container #weather__icon #rain,
.weather__container #weather__icon #snow,
.weather__container #weather__icon #thunderstorm,
.weather__container #weather__icon #mist,
.weather__container #weather__icon #broken-clouds {
  opacity: 0;
}
.weather__container #weather__icon .show {
  opacity: 1;
}
.weather__container .box1 {
  position: absolute;
  top: 40%;
  left: 30%;
  transform: translate(0%, -50%);
  width: 70%;
  height: 80%;
  display: flex;
  align-items: center;
}
.weather__container .box1 #location__name {
  color: #555555;
  font-size: 1.8rem;
}
.weather__container .box1 #current__temperature {
  position: absolute;
  top: 50%;
  right: 15%;
  transform: translate(0%, -50%);
  font-size: 2rem;
  font-weight: 200;
}
.weather__container .box2 {
  position: absolute;
  top: 80%;
  left: 30%;
  transform: translate(0%, -50%);
  width: 40%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.weather__container .box2 #minmax__temperature {
  margin-left: 30px;
  position: relative;
}
.weather__container .box2 #minmax__temperature::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -40px;
  display: block;
  background-image: url(//repo.bfw.wiki/bfwrepo/icon/637c3d88d00b0.png);
  background-size: contain;
  width: 35px;
  height: 35px;
  margin-right: 10px;
}
.weather__container .box2 #humidity {
  position: relative;
}
.weather__container .box2 #humidity::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -40px;
  display: block;
  background-image: url(//repo.bfw.wiki/bfwrepo/icon/637c3dbb08ce7.png);
  background-size: contain;
  width: 35px;
  height: 35px;
}

.search__input {
  width: 500px;
  margin-top: 100px;
}
.search__input form#city__form {
  width: 100%;
  text-align: center;
}
.search__input form#city__form .form__group input#city {
  width: 40%;
  margin: 10px;
  padding: 10px;
  border: none;
  outline: none;
  border-radius: 50px;
  box-shadow: 0 0 20px 10px rgba(0, 0, 0, 0.05);
  text-align: center;
  color: #8b8b8b;
  font-size: 1rem;
  font-weight: 300;
}
.search__input form#city__form .notfound__text {
  display: none;
}
&l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0