Pen Settings



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


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.


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.


                <div class="page-head--masthead">


                // Blurground:
// Create a blurry background image 
// using radial gradients as "pixel 
// blobs". Inspired by Harry Roberts'
// blog post: 
// WARNING: This is ridiculous

// First you need to reduce your source 
// image to the desired size, using 
// Photoshop or similar. In this example 
// I've reduced this image: 
// to 8x4 pixels. Use Photoshop's 
// inkdropper tool to record the colour 
// of each pixel, and list them in a
// a Sass list, like this:

$myColours: #9EA0A3, #9C9A97, #362F29, #15100D, #271E17, #241C17, #040201, #1C1C1C, #A9ABAC, #999999, #190E03, #000000, #6A4D44, #533C37, #000000, #141111, #AC9479, #746454, #0A0300, #3B3134, #715A60, #5C453E, #15100C, #0D0D0D, #A37A52, #49301A, #0D0D0D, #493B3A, #584D51, #624638, #1A0C06, #2A2A2C;

// I guess this bit could be automated
// using Node or ImageMagick or 
// something? I'll leave that job to
// someone smarter than me...

// Blurground will turn each pixel into 
// a radial gradient, or blob. So in 
// this example we'll end up with an 
// 8x4 grid of blobs.

// $rowLength = number of blobs in width
// $columnLength = num. blobs in height
// $colours = your Sass list of colours
@function blurground($rowLength, $columnLength, $colours) {
  // Determines the size of each grid square
  $blobWidth: 100%/$rowLength;
  $blobHeight: 100%/$columnLength;
  // Centre-align each blob within its grid square
  $xOffset: $blobWidth/2;
  $yOffset: $blobHeight/2;
  // Size determines how much the blobs 
  // overlap: if size==width, no overlap
  $xSize: $blobWidth*2;
  $ySize: $blobHeight*2;
  // An empty string which will contain our CSS
  $result: "";
  // This code loops through each colour
  // in the list, creating a radial 
  // gradient (or blob) for each. We
  // know what number blob we're on, and
  // the size of our grid, so calculatin
  // calculating each blob's x & y
  // co-ordinates is just a math problem
  @for $currentBlob from 1 through length($colours) {
    // What row are we on? 
    $row: ceil($currentBlob/$rowLength);
    $const: $row - 1;
    $xPosition: (($currentBlob - ($rowLength * $const)) * $blobWidth) - $xOffset;
    $yPosition: ($blobHeight * $row) - $yOffset;
    $string: "radial-gradient(ellipse #{$xSize} #{$ySize} at #{$xPosition} #{$yPosition}, #{rgba(nth($colours,$currentBlob),1)}, #{rgba(nth($colours,$currentBlob),0)})";
    $separator: "";
    @if ($currentBlob != 1) {
      $separator: ",";
    $result: $result + $separator + $string;
  @return unquote($result);

// 3. USAGE
// That's it! Here's how you'd use 
// the function:
.page-head--masthead {
  background-image: blurground(8,4,$myColours);
  height: 426px;

// Thanks for reading!

// This is just a thought experiment;
// I would never suggest anyone use
// this code in production. The CSS
// it produces could potentially be 
// much heavier than the source image, 
// therefore entirely missing the point 
// of Harry's initial blog post. It was
// fun to mess around with though :D