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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


                <div style="text-align: right">
  <a target="_blank" class="gh" href="">View project on GitHub</a>
<div ng-app="app" ng-controller="demoController as vm" style="text-align: center">
    <div class="countdown-con countdown-xs">
        <countdown countdown-id="cd1" countdown-title="Days Until Christmas" target-date="vm.xmas"></countdown>

    <hr />

    <div class="countdown-con countdown-sm orange">
        <countdown countdown-id="cd2" countdown-title="Hours Until Tomorrow" target-date="vm.tomorrow"></countdown>

    <hr />

    <div class="countdown-con countdown-md">
        <countdown ng-hide="vm.expired.cd3" countdown-id="cd3" countdown-title="Expiring Countdown" target-date="vm.expiring"></countdown>
        <h2 ng-show="vm.expired.cd3">Expired Countdown!</h2>

    <hr />

    <div class="countdown-con countdown-lg orange">
        <countdown countdown-id="cd4" countdown-title="Days Until 2018" target-date="'2018-01-01'"></countdown>
<script type="text/ng-template" id="/dist/countdown.html">
<div class="countdown clearfix" ng-class="vm.countdownId">
    <h2 class="text-uppercase" ng-bind="vm.countdownTitleDisplay"></h2>
    <div ng-hide="vm.hasDate">
        <h1 class="coming-soon">Coming Soon</h1>
    <div class="countdown-row-con" ng-show="vm.hasDate">
        <div class="row row-colons">
            <div class="col-xs-4" ng-if="vm.days">
                <h1 class="well well-lg">
            <div class="col-xs-4">
                <h1 class="well well-lg">
            <div class="col-xs-4">
                <h1 class="well well-lg">
            <div class="col-xs-4" ng-if="!vm.days">
                <h1 class="well well-lg">



                body {
  font: 12px Arial;
  background: white;
} {
  font-size: larger;
  font-weight: bold;
  text-decoration: none;
  background: blue;
  color: white;
  padding: 6px 14px;
  border-radius: 4px;

.countdown-con {
    text-align: center;
    font-size: 10px;
.countdown-xs {
    font-size: 9px;
.countdown-sm {
    font-size: 11px;
.countdown-md {
    font-size: 14px;
.countdown-lg {
    font-size: 20px;
.countdown .well {
    padding: 0;
    display: inline-block;
    width: 1.8em;
    line-height: 1.6em;
    border: 3px solid #54ABAE;
    box-shadow: none;
    background: white;
    margin: 3px auto;
    border-radius: 0;
.countdown h1 {
    font-size: 2.5em;
    font-weight: bold;
.countdown h2 {
    font-size: 1.6em;
    font-weight: bold;
    margin: 10px 0 5px;
.countdown h4 {
    font-size: 1.4em;
    font-weight: normal;
    text-transform: uppercase;
    margin: 0 0 5px;
    color: #54ABAE;
.countdown .row {
    white-space: nowrap;
.countdown .row-colons .col-xs-4:not(:last-child):after {
    content: ':';
    position: absolute;
    font-size: 4.7em;
    right: -0.17em;
    top: -0.12em;
    font-weight: normal;
    color: #54ABAE;
.countdown [class^="col-"] {
    float: none;
    display: inline-block;
    width: auto;
    padding: 0 8px;
    position: relative;
} .well {
    border-color: #FF9E15;
} h4 {
    color: #FF9E15;
} .row-colons .col-xs-4:not(:last-child):after {
    color: #FF9E15;


                  (function() {
    angular.module('app', []);
    angular.module('app').controller('demoController', demoController);

    demoController.$inject = ['$scope']; 
    function demoController($scope) {
      var vm = this;
      vm.tomorrow = new Date();
      vm.tomorrow.setHours(24,0,0,0); // midnignt tomorrow

      vm.xmas = new Date();
      vm.xmas.setHours(0,0,0,0); // midnignt
      vm.expired = {};
      vm.expiring = new Date();
      vm.expiring.setTime(vm.expiring.getTime() + 1000 * 10); // expiring in 10 seconds
      $scope.$on('countdown-expired', function(event, exp) {
        vm.expired[] = true;

    angular.module('app').controller('countdownController', countdownController);
    countdownController.$inject = ['$interval', '$scope']; 
    function countdownController($interval, $scope) {
      /* jshint validthis:true */
      var vm = this;
      vm.targetDate;  // targetDate is bound via the directive
      vm.countdownTitle; // title is bound via the directive
      vm.countdownId; // countdownId is bound via the directive
      vm.countdownTitleDisplay = vm.countdownTitle;

      if (vm.targetDate == '') {
        vm.targetDate = null;

      vm.hasDate = !!vm.targetDate;
      if (!vm.hasDate) {
        vm.countdownTitleDisplay = vm.countdownTitle.replace("Coming In", '');

      var endDate = new Date(vm.targetDate);


      var msPerSecond = 1000;
      var msPerMinute = 60 * msPerSecond;
      var msPerHour = msPerMinute * 60;
      var msPerDay = msPerHour * 24;
      var stop;


      function activate() {
        var timeDiff = endDate.getTime() - new Date().getTime();
        if (timeDiff <= 0) {
          vm.days = vm.hours = vm.minutes = vm.seconds = 0;
          stop && $interval.cancel(stop);
          stop = undefined;
          $scope.$emit('countdown-expired', { name: vm.countdownId });

        vm.days = Math.floor(timeDiff / msPerDay);
        timeDiff -= vm.days * msPerDay;
        vm.hours = Math.floor(timeDiff / msPerHour);
        timeDiff -= vm.hours * msPerHour;
        vm.minutes = Math.floor(timeDiff / msPerMinute);
        timeDiff -= vm.minutes * msPerMinute;
        vm.seconds = Math.floor(timeDiff / msPerSecond);

      stop = $interval(activate, msPerSecond);
    angular.module('app').directive('countdown', countdown);
    countdown.$inject = [];
    function countdown () {
      // Usage:
      //     <countdown></countdown>
      // Creates:
      return {
        restrict: 'E',
        templateUrl: '/dist/countdown.html',
        controller: 'countdownController',
        controllerAs: 'vm',
        scope: {
          targetDate: '=',
          countdownTitle: '@',
          countdownId: '@'
        bindToController: true