Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <link rel="stylesheet" href="main.css" />
  <div class="app-wrap">
      <input type="text" autocomplete="off" class="search-box" placeholder="Поиск города..." />
      <section class="location">
        <div class="city">Введите название города выше :-)</div>
        <div class="date"></div>
      <div class="current">
        <div class="temp"><span></span></div>
        <div class="weather"></div>
        <div class="hi-low"></div>
  <script src="main.js"></script>



                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

body {
  font-family: 'montserrat', sans-serif;
  background-image: url('');
  background-size: cover;
  background-position: top center;

.app-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px 15px 15px;

header input {
  width: 100%;
  max-width: 280px;
  padding: 10px 15px;
  border: none;
  outline: none;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 16px 0px 16px 0px;
  border-bottom: 3px solid #DF8E00;
  color: #313131;
  font-size: 20px;
  font-weight: 300;
  transition: 0.2s ease-out;

header input:focus {
  background-color: rgba(255, 255, 255, 0.6);

main {
  flex: 1 1 100%;
  padding: 25px 25px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

.location .city {
  color: #FFF;
  font-size: 32px;
  font-weight: 500;
  margin-bottom: 5px;

.location .date {
  color: #FFF;
  font-size: 16px;

.current .temp {
  color: #FFF;
  font-size: 102px;
  font-weight: 900;
  margin: 30px 0px;
  text-shadow: 2px 10px rgba(0, 0, 0, 0.6);

.current .temp span {
  font-weight: 500;

.current .weather {
  color: #FFF;
  font-size: 32px;
  font-weight: 700;
  font-style: italic;
  margin-bottom: 15px;
  text-shadow: 0px 3px rgba(0, 0, 0, 0.4);

.current .hi-low {
  color: #FFF;
  font-size: 24px;
  font-weight: 500;
  text-shadow: 0px 4px rgba(0, 0, 0, 0.4);



                const api = {
  key: "d731178cdda888edc339cec9d8b7cac3",
  base: ""

const searchbox = document.querySelector('.search-box');
searchbox.addEventListener('keypress', setQuery);

function setQuery(evt) {
  if (evt.keyCode == 13) {

function getResults (query) {
    .then(weather => {
      return weather.json();

function displayResults (weather) {
  let city = document.querySelector('.location .city');
  city.innerText = `${}, ${}`;

  let now = new Date();
  let date = document.querySelector('.location .date');
  date.innerText = dateBuilder(now);

  let temp = document.querySelector('.current .temp');
  temp.innerHTML = `${Math.round(weather.main.temp)}<span>°c</span>`;

  let weather_el = document.querySelector('.current .weather');
  weather_el.innerText =[0].main;

  let hilow = document.querySelector('.hi-low');
  hilow.innerText = `${Math.round(weather.main.temp_min)}°c / ${Math.round(weather.main.temp_max)}°c`;

function dateBuilder (d) {
  let months = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
  let days = ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"];

  let day = days[d.getDay()];
  let date = d.getDate();
  let month = months[d.getMonth()];
  let year = d.getFullYear();

  return `${day} ${date} ${month} ${year}`;