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.


                <body ng-app="myApp" ng-controller="AppCtrl as app">

  <div class="navbar" anchor-scroll-y-offset>
      Scroll to:
      <select ng-model="hash" ng-change="app.scrollTo(hash)"
          ng-options="anchor as ('#' + anchor) for (anchor, _) in ::app.anchors">
        <option value="">--- Top ---</option>

  <div class="block" id="{{::anchor}}" ng-cloak ng-repeat="(anchor, content) in ::app.anchors"
      ng-style="{backgroundColor: 'rgba(150, 150, 150, ' + ($index / 5) + ')'}">
    <span class="anchor-label">#{{ ::anchor }}</span>
    <span class="block-content">{{ ::content }}</span>

  <!-- -=-=-=-=- -=[IGNORE BELOW THIS LINE]=- -=-=-=-=- -->
  <!-- Page Footer -->
  <small class="footer" ng-non-bindable>
    <div ng-app="footerApp" ng-controller="FooterCtrl as footer" ng-cloak>
      <span class="left">
        <b>Angular v{{footer.version.full}}</b>
      <span class="right">
        <a ng-href="{{}}" target="_blank">




                body {
  padding-top: 45px;

.block {
  align-items: center;
  border: 3px solid DarkOrchid;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  min-height: 200px;
  position: relative;

.block .anchor-label {
  background-color: Black;
  border-radius: 50px;
  color: DarkSalmon;
  left: 5px;
  padding: 5px 10px;
  position: absolute;
  top: 5px;

.block .block-content {
  color: LimeGreen;
  font-size: 2em;
  font-weight: bold;
  text-shadow: 0 0 2px Black;

.navbar {
  background-color: White;
  box-shadow: 0 0 5px;
  left: 0;
  padding: 10px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10;

/* -=-=-=-=- -=[IGNORE BELOW THIS LINE]=- -=-=-=-=- */
/* Page Footer */
body { padding-bottom: 2em; }
.footer { background-color: White; border-top: 1px solid rgba(100, 100, 100, 0.33); bottom: 0; display: block; font-size: 0.75em; height: 1.5em; left: 0; margin: 0 5px; overflow: auto; padding: 5px; position: fixed; right: 0; }
.footer > div { display: flex; flex-direction: row; }
.footer .left { flex-grow: 2; text-align: left; }
.footer .right { flex-grow: 1; text-align: right; }
[ng-cloak] { display: none !important; }


                (function () {'use strict';

  module('myApp', []).
  controller('AppCtrl', AppCtrl).
  directive('anchorScrollYOffset', anchorScrollYOffsetDirective);

function AppCtrl($anchorScroll, $location, $timeout) {
  // Variables - Private
  var self = this;

  // Variables - Public
  self.anchors = {
    anchor1: 'This is block #1',
    anchor2: 'This is block #2',
    anchor3: 'This is block #3',
    anchor4: 'This is block #4',
    anchor5: 'This is block #5'

  // Functions - Public
  self.scrollTo = $anchorScroll;

function anchorScrollYOffsetDirective($anchorScroll) {
  // DDO
  return {
    restrict: 'A',
    link: anchorScrollYOffsetPostLink
  // Functions - Definitions
  function anchorScrollYOffsetPostLink(scope, elem) {
    $anchorScroll.yOffset = elem;


/* -=-=-=-=- -=[IGNORE BELOW THIS LINE]=- -=-=-=-=- */
/* Page Footer */
(function () {'use strict';
var app = 'footerApp';
angular.module(app, []).controller('FooterCtrl', FooterCtrl);
angular.bootstrap(document.querySelector('[ng-app="' + app + '"]'), [app]);
function FooterCtrl($window) {
  this.version = $window.angular.version; = {name: 'GKalpak', url: '//'};