Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <h1>OpenWeather Basics - Part 2</h1>
<p>Below is a breakdown of what the data in the response means.</p>

<div id="app">
	<table>
		<thead>
			<tr>
				<th>Attribute</th>
				<th>Description</th>
				<th>Value</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>coord.lon</td>
				<td>City geo location, longitude</td>
				<td>{{data.coord.lon}}</td>
			</tr>
			<tr>
				<td>coord.lat</td>
				<td>City geo location, latitude</td>
				<td>{{data.coord.lat}}</td>
			</tr>
			<tr>
				<td>weather.id</td>
				<td>Weather condition id</td>
				<td>{{data.weather[0].id}}</td>
			</tr>
			<tr>
				<td>weather.main</td>
				<td>Group of weather parameters (Rain, Snow, Extreme etc.)</td>
				<td>{{data.weather[0].main}}</td>
			</tr>
			<tr>
				<td>weather.description</td>
				<td>Weather condition within the group. You can get the output in your language.</td>
				<td>{{data.weather[0].description}}</td>
			</tr>
			<tr>
				<td>weather.icon</td>
				<td>Weather icon id</td>
				<td>{{data.weather[0].icon}}</td>
			</tr>
			<tr>
				<td>main.temp</td>
				<td>Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.</td>
				<td>{{data.main.temp}}</td>
			</tr>
			<tr>
				<td>main.feels_like</td>
				<td>Temperature. This temperature parameter accounts for the human perception of weather. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.</td>
				<td>{{data.main.feels_like}}</td>
			</tr>
			<tr>
				<td>main.pressure</td>
				<td>Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa</td>
				<td>{{data.main.pressure}}</td>
			</tr>
			<tr>
				<td>main.humidity</td>
				<td>Humidity, %</td>
				<td>{{data.main.humidity}}</td>
			</tr>
			<tr>
				<td>main.temp_min</td>
				<td>Minimum temperature at the moment. This is minimal currently observed temperature (within large megalopolises and urban areas). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.</td>
				<td>{{data.main.temp_min}}</td>
			</tr>
			<tr>
				<td>main.temp_max</td>
				<td>Maximum temperature at the moment. This is maximal currently observed temperature (within large megalopolises and urban areas). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.</td>
				<td>{{data.main.temp_max}}</td>
			</tr>
			<tr>
				<td>wind.speed</td>
				<td>Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.</td>
				<td>{{data.wind.speed}}</td>
			</tr>
			<tr>
				<td>wind.deg</td>
				<td>Wind direction, degrees (meteorological)</td>
				<td>{{data.wind.deg}}</td>
			</tr>
			<tr>
				<td>wind.gust</td>
				<td>Wind gust. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour</td>
				<td>{{data.wind.gust}}</td>
			</tr>
			<tr>
				<td>clouds.all</td>
				<td>Cloudiness, %</td>
				<td>{{data.clouds.all}}</td>
			</tr>
			<tr>
				<td>dt</td>
				<td>Time of data calculation, unix, UTC</td>
				<td>{{data.dt}}</td>
			</tr>
			<tr>
				<td>sys.country</td>
				<td>Country code (GB, JP etc.)</td>
				<td>{{data.sys.country}}</td>
			</tr>
			<tr>
				<td>sys.sunrise</td>
				<td>Sunrise time, unix, UTC</td>
				<td>{{data.sys.sunrise}}</td>
			</tr>
			<tr>
				<td>sys.sunset</td>
				<td>Sunset time, unix, UTC</td>
				<td>{{data.sys.sunset}}</td>
			</tr>
			<tr>
				<td>timezone</td>
				<td>Shift in seconds from UTC</td>
				<td>{{data.timezone}}</td>
			</tr>
			<tr>
				<td>id</td>
				<td>City ID</td>
				<td>{{data.id}}</td>
			</tr>
			<tr>
				<td>name</td>
				<td>City name</td>
				<td>{{data.name}}</td>
			</tr>
		</tbody>
	</table>
</div>
              
            
!

CSS

              
                tbody tr:nth-child(odd) {
  background-color: #AAC4FF;
}
td {
	width: 30%;
}
              
            
!

JS

              
                var app = new Vue({
  el: '#app',
  data: {
    latitude: 43.04,
		longitude: -87.91,
		apikey: '3bc136475f8d482370dc590732076256',
		data: []
  },
  mounted() {
    // Get the current weather from OpenWeather (https://openweathermap.org/current)
    axios
    .get("https://api.openweathermap.org/data/2.5/weather?lat="+this.latitude+"&lon="+this.longitude+"&appid="+this.apikey)
      .then(response=> (this.data = response.data))
  }
})
              
            
!
999px

Console