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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!-- JJ -->
<div id="contentBoxApp" ng-app="contentBoxApp">
  <div id="GridCtrl" ng-controller="GridCtrl">  
    <div class="toolbar">
      <div class="container">
        <div class="toolbar-section">
          <span class="logo toolbar-item"><i class="fa fa-picture-o"></i>ContentGrid</span>
        </div><!-- /.toolbar-section -->
        <div class="toolbar-section">
          <div class="toolbar-item form-field">
            <input type="text" name="filter" placeholder="phrase to filter" ng-model="search"/>
          </div>
        </div><!-- /.toolbar-section -->
      </div><!-- /.container -->
    </div><!-- /.toolbar -->
    <div class="container dynamic-grid">
      <article class="grid-item content-box" ng-repeat="(gridKey, gridItem) in gridItems | filter:filterBySearch">
        <div class="inner">
        <img class="content-box-thumb"src="{{ gridItem.img }}" alt="tech image" />
        <h1 class="content-box-header">
          {{ gridItem.headerText }}
        </h1>
        <p class="content-box-blurb">
          {{ gridItem.blurbText }}
        </p>
        <a class="readmore-link" href="#" ng-click="toggleBlurb($event)">read more</a>
        </div>
      </article><!-- /.content-box -->

    </div><!-- /.dynamic-grid -->
  </div><!-- /#GridCtrl -->
</div><!-- /#contentBoxApp -->
<!-- SDG -->
            
          
!
            
              $bg: rgba(255,255,255, 1);
$fg: rgba(58,58,58, 1);
$linkColor: #0074D9;
$border: 0px solid rgba(230,230,230,1);
$margin: 1rem;
$padding: 1rem 1rem 1rem 1rem;
$lineHeight: 1.4rem;
$boxShadowColor: rgba(58,58,58,0.1);
$boxShadow: 0px -1px 2px $boxShadowColor, 1px 1px 2px $boxShadowColor;
$gradient: linear-gradient(rgba(0,0,0,0.07), rgba(255,255,255,0));
$navFg: rgba(255,255,255, 1);
$navBg: rgba(58,58,58, 0.95);
$navBg: rgba(25,47,66, 0.95);
body * {
  font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: $lineHeight;
}
body {
  background: #efefef;
  color: $fg;

  &:before {
    content: '';
    display: block;
    position: fixed;
    z-index: 0;
    height: 100%;
    width: 100%;
    max-height: 100vh;
    max-width: 100wh;
    top: 0px;
    left: 0px;
    box-shadow: inset 0px 0px 50px rgba(0,0,0,0.55);
  }
}
a {
  color: $linkColor;
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.75;
  linear-gradient: ease-in-out 0.6s;
  &:hover {
    linear-gradient: ease-in-out 0.6s;
    opacity: 1;
  }
}
.container {
  width: 90%;
  max-width: 1280px;
  margin: 0px auto;
}
.toolbar {
  position: fixed;
  z-index: 2;
  width: 100%;
  height: 3.75rem;
  padding: 0px;
  vertical-align: middle;
  overflow: hidden;
  background: $navBg;
  color: $navFg;
  box-shadow: 0px 0px 25px rgba(0,0,0,0.25);
}
.toolbar-section {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  
  &:first-child { 
    width: 60%;
  }
  &:last-child {
    width: 35%;
  }
  @media (max-width: 480px) {
    display: block;
    &:last-child {
      display: none;
    }
  }
}
.toolbar-item {
  display: block;
  padding: $padding;
  white-space: nowrap;
}
.form-field {
  text-align: right;
  input {
    font-size: 1rem;
    line-height:1.4rem;
    height: 1.4rem;
    max-width: 100%;
    display: inline-block;
    padding: 4px 7px;
    border: 1px solid lighten($navBg, 5%);
    background: darken($navBg, 02%);
    outline: 0px;
    color: lighten($navBg, 50%);
    //$placeholderColor: lighten($navBg, 10%);
    $placeholderColor: rgba(255,255,255,0.35);
    &::-webkit-input-placeholder { color: $placeholderColor; }
    &:-moz-placeholder { color: $placeholderColor; }
    &::-moz-placeholder { color: $placeholderColor; }
    &:-ms-input-placeholder { color: $placeholderColor; }
    
  }
}
.logo { 
  font-family: "Oswald", Helvetica, Arial, sans-serif;
  font-size: 1em;
  letter-spacing: 0.15rem;
  i { font-size: 1.2em; margin-right: 6px; }
}
.dynamic-grid {
  position: relative;
  z-index: 1;
  columns: 240px 3;
	column-gap: 15px;
  &.container {
    padding-top: 6rem;
  }
}
.grid-item {
  position: relative;
  display: inline-block;
  margin: $margin;
  max-width: 100%;
  column-break-inside: avoid;
  .inner {
    padding: $padding;
  }
}
.content-box {
  border: $border;
  background-color: $bg;
  box-shadow: $boxShadow;
  
  &:before {
    content: '';
    position: absolute;
    display: block;
    width: 100%;
    height: 4rem;
    left: 0px;
    top: 0px;
  }
  
}
.content-box-thumb {
  display: block;
  max-width: 100%;
  height: auto;
}
.content-box-header {
  font-size: 1rem;
  margin: 0.75rem 0rem 0rem 0rem;
}
.content-box-blurb {
  font-size: 0.85rem;
  display: block;
  display: -webkit-box;
  margin: 0rem;
  max-width: 100%;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readmore-link { 
  display: block;
  margin: 5px 5px 0px 5px;
  text-align: right;
}
            
          
!
            
              var contentBoxApp = angular.module('contentBoxApp', []);
var gridCtrl = contentBoxApp.controller('GridCtrl', function($scope) {
  var regex;
  $scope.escapeRegExp = function(string){
      return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
  };
  $scope.gridItems = [
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/QrXgXMhCSouyhU7idq7g_IMG_8402.jpg',
      headerText: 'Fireworks on the 4th',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil voluptatibus aliquam asperiores, cum distinctio aliquid recusandae velit beatae. Reprehenderit in eum, expedita, alias explicabo iure amet. Assumenda consequuntur vitae fugit.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/dandelion.jpg',
      headerText: 'Dandelion',
      blurbText: 'cliff Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae assumenda facilis qui minus, consequuntur reiciendis atque fugiat ullam id, placeat nam quas, voluptates ipsum velit voluptatum culpa numquam saepe quos!'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/C3EWdWzT8imxs0fKeKoC_blackforrest.jpg',
      headerText: 'Cabin in the Woods',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam vero cum vitae laboriosam nemo quaerat, sapiente harum reiciendis voluptas itaque incidunt molestias, fugiat asperiores dolores officiis architecto nihil assumenda. Fugiat!'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplash_522b9cc0386f1_1.jpg',
      headerText: 'Lazy Sunday',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit, ex minima, fugiat itaque error voluptates inventore sunt sequi possimus tempore odit debitis sint. Repudiandae quia esse totam eum blanditiis sunt?'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/MIbCzcvxQdahamZSNQ26_12082014-IMG_3526.jpg',
      headerText: 'Yogi',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque nisi magnam cum nam iusto fugiat suscipit tempora nostrum autem, quasi, nemo illo sunt vitae id consectetur. Culpa reprehenderit esse sapiente?'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/cA4aKEIPQrerBnp1yGHv_IMG_9534-3-2.jpg',
      headerText: 'Antique Typewriter',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi, blanditiis autem, ex quidem hic unde dolorum deleniti tenetur repellat nesciunt delectus pariatur voluptate corrupti inventore iure, itaque, fuga natus doloribus.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1428604467652-115d9d71a7f1.jpeg',
      headerText: 'The Sun is Setting',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque et amet aspernatur ullam, accusamus cum. Minima obcaecati voluptate velit cupiditate error ut, suscipit saepe beatae eaque veniam. Maiores, reiciendis quo.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1422640805998-18a4dd89bec2.jpeg',
      headerText: 'Staring at the Stars',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit ducimus recusandae deleniti nobis unde dolor minus ut corporis saepe tempora architecto, possimus! Obcaecati odit nam vero ipsum odio vel iste.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-IPEivX6xSBaiYOukY88V_DSC06462_tonemapped.jpg',
      headerText: 'On the Road Again',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Unde, laboriosam impedit expedita alias quod repellendus reiciendis, officiis ullam iste delectus perferendis odio officia, commodi nihil voluptas aliquam. Enim, minus, unde!'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1428591501234-1ffcb0d6871f.jpeg',
      headerText: 'Just Me, Myself, and I',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia quidem alias libero vel sunt quod non, aspernatur rerum nisi porro corrupti minus unde hic nemo labore veniam! Ipsa, nam, quas!'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1427348693976-99e4aca06bb9.jpeg',
      headerText: 'Early Morning Hike',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quam, sequi, cumque temporibus, mollitia obcaecati earum provident labore adipisci repellendus fugiat repellat quas doloribus incidunt ipsum. Tempore delectus quas illum ex!'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1414912925664-0c502cc25dde.jpeg',
      headerText: 'Getting Away for the Weekend',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Temporibus voluptate nam provident, nulla recusandae maxime fugit praesentium blanditiis sunt, veniam quasi, mollitia possimus consequuntur nemo qui repellat adipisci accusamus ullam.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1428342319217-5fdaf6d7898e.jpeg',
      headerText: 'The Bridge',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit ducimus recusandae deleniti nobis unde dolor minus ut corporis saepe tempora architecto, possimus! Obcaecati odit nam vero ipsum odio vel iste.'
    },
    {
      img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/6234/unsplashed2-photo-1423483641154-5411ec9c0ddf.jpeg',
      headerText: 'Visit to the Vineyard',
      blurbText: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit ducimus recusandae deleniti nobis unde dolor minus ut corporis saepe tempora architecto, possimus! Obcaecati odit nam vero ipsum odio vel iste.'
    }
  ];
  $scope.search = '';
  $scope.$watch('search', function (value) {
      regex = new RegExp('\\b' + $scope.escapeRegExp(value), 'i');
  });
  $scope.filterBySearch = function(gridItem) {
      if (!$scope.search) return true;
      return regex.test(gridItem.headerText + " " + gridItem.blurbText);
  };
  $scope.toggleBlurb = function($event) {
    console.log($event);
  };
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console