输入城市名搜索查询天气预报效果代码
代码语言: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; } </style> </head> <body> <main> <div class="weather__container"> <div id="units__toggle"> <button id="celsius" class="active">C</button> <button id="fahrenheit">F</button> </div> <div id="weather__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 290 290"> <defs> <linearGradient id="linear-gradient" x1="145.2" y1="17.8" x2="145.2" y2="315.1" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#f2c94c" /> <stop offset="1" stop-color="#f2994a" /> </linearGradient> <linearGradient id="linear-gradient-2" x1="123.9" y1="29.7" x2="123.9" y2="283.5" xlink:href="#linear-gradient" /> <linearGradient id="linear-gradient-3" x1="178" y1="308.5" x2="107.6" y2="89.4" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#b8e9e6" /> <stop offset="1" stop-color="#fff" /> </linearGradient> <linearGradient id="linear-gradient-4" x1="205" y1="270.8" x2="80.8" y2="54.8" xlink:href="#linear-gradient-3" /> <linearGradient id="linear-gradient-5" x1="137.8" y1="171.3" x2="62.7" y2="26.6" xlink:href="#linear-gradient-3" /> <linearGradient id="linear-gradient-6" x1="189" y1="306.7" x2="125.4" y2="109" xlink:href="#linear-gradient-3" /> <linearGradient id="linear-gradient-7" x1="205" y1="230.2" x2="80.8" y2="14.2" xlink:href="#linear-gradient-3" /> <linearGradient id="linear-gradient-9" x1="145.2" y1="127.7" x2="145.2" y2="326.2" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#ffca00" /> <stop offset="1" stop-color="#fff" /> </linearGradient> <linearGradient id="linear-gradient-10" x1="203.7" y1="230.2" x2="79.4" y2="14.2" xlink:href="#linear-gradient-3" /> <linearGradient id="linear-gradient-11" x1="109.6" y1="235.6" x2="73.3" y2="150.4" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#a4bcda" /> <stop offset="1" stop-color="#d2e1ff" /> </linearGradient> <linearGradient id="linear-gradient-13" x1="194.2" y1="191.7" x2="157.9" y2="106.6" xlink:href="#linear-gradient-11" /> <linearGradient id="linear-gradient-15" x1="194.2" y1="280.4" x2="157.9" y2=".........完整代码请登录后点击上方下载按钮下载查看
网友评论0