Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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

              
                <div ng-app="weatherApp" ng-controller="forecastController" class="component--weatherBox">
	<div class="panel">
		<div class="weather-data">
			<h1>{{ weather.city.name }}</h1><small>{{ dailyForecast[0].weather[0].description }}</small>
		</div>
		<div class="currentTemp"><i ng-class="applyIcon(dailyForecast[0].weather[0].icon)" class="wi"></i><i class="wi wi-degrees"></i></div>
	</div>
	<div class="component--weatherBox-row">
		<div ng-repeat="daily in dailyForecast track by $index" class="content">
			<div class="component--weatherBox-heading">{{ day($index) }}</div>
			<div class="component--weatherBox-info"><i ng-class="applyIcon(daily.weather[0].icon)" class="wi"></i><span class="degrees">{{ daily.temp.day | number: 0}}<i class="wi wi-degrees"></i></span></div>
		</div>
	</div>
</div>
              
            
!

CSS

              
                /* Variables */

$bg-main: #E06B4F
	
/* Styles */
body
	background: #dce2e5
	font-family: 'Roboto', sans-serif
	font-weight: 100
	font-size: 11px

.component--weatherBox
	margin: 30px auto
	width: 420px
	border: 1px solid darken($bg-main, 3%)
	border-radius: 10px
	overflow: hidden
	box-shadow: 2px 5px 20px 1px #444

.panel
	position: relative
	overflow: hidden
	color: #fff
	background: $bg-main
	height: 120px
	&:before
		content: ''
		display: block
		position: absolute
		left: 0
		top: 0
		width: 100%
		height: 100%
		z-index: 1
		opacity: 0.3
		background-image: url('https://nunnz.files.wordpress.com/2013/11/4.jpg')
		background-repeat: no-repeat
		background-position: 0 63%
		background-size: cover

.weather-data
	width: 50%
	text-align: center
	display: inline-block
	float: left
	z-index: 2
	position: relative

h1
	font-weight: 400
	font-size: 40px
	line-height: 40px
	padding-bottom: 0
	margin-bottom: 0
	margin-top: 0.75em

.currentTemp
	width: 50%
	z-index: 2
	text-align: center
	float: left
	font-size: 50px
	text-align: center
	margin-top: 0.5em
	position: relative
	vertical-align: middle
	.degrees
		line-height: 40px
	.wi-degrees
		margin-left: -10px
		vertical-align: top!important // ish
	.wi
		margin-right: 20px
		font-size: 40px
		vertical-align: baseline

.component--weatherBox-row
	display: flex
	clear: both
	
.content
	flex: 1
	text-align: center

.component--weatherBox-heading
	background: lighten($bg-main, 8%)
	border: 1px solid darken($bg-main, 10%)
	border-left: none
	text-transform: uppercase
	color: #fff
	font-weight: 800
	padding: 10px
	
.component--weatherBox-info
	background: #fff
	color: $bg-main
	padding-bottom: 10px
	border-right: 1px solid darken($bg-main, 10%)
	.wi
		display: block
		margin: 0 auto
		font-size: 24px
		padding: 15px 0
	.degrees
		font-size: 20px
		line-height: 20px
		.wi-degrees
			display: inline
	
small
	font-size: 12px
              
            
!

JS

              
                /* work in progress:

>> fix controller structure; need to take everything out of $http

*/

angular.module('weatherApp', [])

.controller('forecastController', ['$scope', '$http', '$filter', 
  function ($scope, $http, $filter) {
		
		$http.get('https://api.openweathermap.org/data/2.5/forecast/daily?id=4684888&cnt=7&units=imperial&APPID=' + YOUR_APP_ID)
			.success(function(data) {
				$scope.weather = data;
				$scope.dailyForecast = data.list;
			
				$scope.currentTemp = $filter('number')($scope.dailyForecast[0].temp.day, 0);
				$scope.day = function(index){
					return $filter('date')($scope.dailyForecast[index].dt * 1000, 'EEE');
				}
			});
		
			$scope.applyIcon = function(icon){

				if(icon === '01d'){
					return ('wi-day-sunny');
				}
				else if(icon === '01n'){
					return ('wi-night-clear');	
				}
				else if(icon === '02d' || '02n'){
					return ('wi-cloudy');
				}
				else if(icon === '03d' || '03n' || '04d' || '04n'){
					return ('wi-night-cloudy');
				}
				else if(icon === '09d' || '09n'){
					return ('wi-showers');
				}
				else if(icon === '10d' || '10n'){
					return ('wi-rain');	
				}
				else if(icon === '11d' || '11n'){
					return ('wi-thunderstorm');
				}
				else if(icon === '13d' || '13n'){
					return ('wi-snow');
				}
				else if(icon === '50d' || '50n'){
					return ('wi-fog');
				}
				else { // whoa, desctruction!
					return ('wi-meteor'); 
				}
			};
			
			$scope.weatherLink = 'http://openweathermap.org/img/w/'+ $scope.applyIcon() + '.png';	
}]);
              
            
!
999px

Console