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

              
                <header class="header">
  <h1>Top <span class="nope">50</span> Favorite Albums</h1>
  <h2>by <a href="http://conwaydev.com">Justin Conway</a></h2>

  <p>Inspired by <a href="http://mattsoria.com/lists#top-100-albums">Matt Soria</a>, this is populated by a Discog's list and isn't really in any particular order. I wanted to be able to pull in the cover art for each release, but the Discogs API is weird and I'm lazy so I stole this vinyl CSS from <a href="https://codepen.io/thebabydino/pen/HjJlL">this pen</a>. If you're interested you can click on a record to see it's Discogs page and pick it up, theres some good records here!</p>
</header>

<main class="albums js-albumlist"></main>
              
            
!

CSS

              
                $black: #242423;
$white: #F4FFF8;

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

html {
  box-sizing: border-box;
}

body {
  background: $white;
  font-family: Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  text-align: center;
  color: $black;
}

.header {
  margin: 4rem auto;
  max-width: 44rem;
  padding: 0 2rem;
  a {
    color: $black;
  }
  h2 {
    font-weight: normal;
  }
  p {
    margin-top: 1rem;
  }
}

.albums {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-around;
  margin: 0 2rem;
}

// For the record I *totally* stole this CSS from https://codepen.io/thebabydino/pen/HjJlL, Thanks Ana Tudor!
.album {
  position: relative;
  display: flex;
  align-items: center;
  margin: .5rem;
  padding: .5rem;
  height: 170px;
  width: 170px;
  border-radius: 50%;
  color: $white;
  text-decoration: none;
  background: linear-gradient(30deg, transparent 40%, rgba(42, 41, 40, .85) 40%) no-repeat 100% 0, linear-gradient(60deg, rgba(42, 41, 40, .85) 60%, transparent 60%) no-repeat 0 100%, repeating-radial-gradient(#2a2928, #2a2928 4px, #ada9a0 5px, #2a2928 6px);
  background-size: 50% 100%, 100% 50%, 100% 100%;
  &::after {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -35px;
    border: solid 1px #d9a388;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px #32DE8A, inset 0 0 0 27px #32DE8A;
    background: $white;
    content: '';
    z-index: 1;
  }
  &._gray::after {
    box-shadow: 0 0 0 4px #D6DBD2, inset 0 0 0 27px #D6DBD2;
  }
  &._yellow::after {
    box-shadow: 0 0 0 4px #EFCA08, inset 0 0 0 27px #EFCA08;
  }
  &._red::after {
    box-shadow: 0 0 0 4px #EE2E31, inset 0 0 0 27px #EE2E31;
  }
  &._blue::after {
    box-shadow: 0 0 0 4px #145C9E, inset 0 0 0 27px #145C9E;
  }
  &._purple::after {
    box-shadow: 0 0 0 4px #54457F, inset 0 0 0 27px #54457F;
  }
  &._orange::after {
    box-shadow: 0 0 0 4px #F45D01, inset 0 0 0 27px #F45D01;
  }
  &._pink::after {
    box-shadow: 0 0 0 4px #E75A7C, inset 0 0 0 27px #E75A7C;
  }
  &._tan::after {
    box-shadow: 0 0 0 4px #F6F5AE, inset 0 0 0 27px #F6F5AE;
  }
  &._teal::after {
    box-shadow: 0 0 0 4px #17BEBB, inset 0 0 0 27px #17BEBB;
  }
  &:hover {
    animation: spin 3s infinite linear;
  }
  span {
    display: block;
    width: 100%;
    z-index: 2;
    text-shadow: 1px 1px 3px rgba($black, 1);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
              
            
!

JS

              
                // Here's my top 100 favorite albums list:
// http://mattsoria.com/lists#top-100-albums
//
// 1] Fork this pen, make your own (It doesn't have to bee 100)
// 2] Maybe add a little style?
// 3] When you're done post the link in a comment on this pen

const albumContainer = document.querySelector('.js-albumlist');
const albumCovers = ['_gray', '_blue', '_red', '_green', '_purple', '_yellow', '_pink', '_orange', '_tan', '_teal'];

function listOutAlbums(albums) {
  albums.forEach((album) => albumContainer.insertAdjacentHTML('beforeend', `<a href="${album.uri}" class="album ${albumCovers[Math.floor(Math.random() * albumCovers.length)]}" target="_blank" rel="noopener"><span>${ album.display_title}</span></a>`));
}

axios.get('//api.discogs.com/lists/310367')
  .then((response) => listOutAlbums(response.data.items))
  .catch((error) => {
    
    // For some reason axios doesn't like to work in any browser but chrome, IDGI but I'm too lazy, if you're browsing in *not* chrome then theres a hardcoded list that won't get updated, smh fml
    
    const hardcodedAlbumArray = [{comment:"",display_title:"Dear Nora - Mountain Rock",uri:"http://www.discogs.com/Dear-Nora-Mountain-Rock/release/2018794",image_url:"",resource_url:"http://api.discogs.com/releases/2018794",type:"release",id:2018794},{comment:"",display_title:"John Prine - Sweet Revenge",uri:"http://www.discogs.com/John-Prine-Sweet-Revenge/master/133500",image_url:"",resource_url:"http://api.discogs.com/masters/133500",type:"master",id:133500},{comment:"",display_title:"Bright Eyes - Digital Ash In A Digital Urn",uri:"http://www.discogs.com/Bright-Eyes-Digital-Ash-In-A-Digital-Urn/master/3001",image_url:"",resource_url:"http://api.discogs.com/masters/3001",type:"master",id:3001},{comment:"",display_title:"Bedhed - The Destruction Manual",uri:"http://www.discogs.com/Bedhed-The-Destruction-Manual/release/7438017",image_url:"",resource_url:"http://api.discogs.com/releases/7438017",type:"release",id:7438017},{comment:"",display_title:"Lucinda Williams - Car Wheels On A Gravel Road",uri:"http://www.discogs.com/Lucinda-Williams-Car-Wheels-On-A-Gravel-Road/master/87369",image_url:"",resource_url:"http://api.discogs.com/masters/87369",type:"master",id:87369},{comment:"",display_title:"Darkthrone - Panzerfaust",uri:"http://www.discogs.com/Darkthrone-Panzerfaust/master/5605",image_url:"",resource_url:"http://api.discogs.com/masters/5605",type:"master",id:5605},{comment:"",display_title:"Descendents - I Don't Want To Grow Up",uri:"http://www.discogs.com/Descendents-I-Dont-Want-To-Grow-Up/master/29758",image_url:"",resource_url:"http://api.discogs.com/masters/29758",type:"master",id:29758},{comment:"",display_title:"Joyce Manor - Joyce Manor",uri:"http://www.discogs.com/Joyce-Manor-Joyce-Manor/master/325483",image_url:"",resource_url:"http://api.discogs.com/masters/325483",type:"master",id:325483},{comment:"",display_title:"The Delines - Colfax",uri:"http://www.discogs.com/The-Delines-Colfax/release/5683324",image_url:"",resource_url:"http://api.discogs.com/releases/5683324",type:"release",id:5683324},{comment:"",display_title:"Algernon Cadwallader - Parrot Flies",uri:"http://www.discogs.com/Algernon-Cadwallader-Parrot-Flies/release/3502670",image_url:"",resource_url:"http://api.discogs.com/releases/3502670",type:"release",id:3502670},{comment:"",display_title:"Caitlin Rose - The Stand-In",uri:"http://www.discogs.com/Caitlin-Rose-The-Stand-In/release/4345058",image_url:"",resource_url:"http://api.discogs.com/releases/4345058",type:"release",id:4345058},{comment:"",display_title:"Songs: Ohia - The Magnolia Electric Co",uri:"http://www.discogs.com/Songs-Ohia-The-Magnolia-Electric-Co/release/789354",image_url:"",resource_url:"http://api.discogs.com/releases/789354",type:"release",id:789354},{comment:"",display_title:"Magnolia Electric Co. - Josephine",uri:"http://www.discogs.com/Magnolia-Electric-Co-Josephine/release/1922546",image_url:"",resource_url:"http://api.discogs.com/releases/1922546",type:"release",id:1922546},{comment:"",display_title:"Bright Eyes - The People's Key",uri:"http://www.discogs.com/Bright-Eyes-The-Peoples-Key/release/2801152",image_url:"",resource_url:"http://api.discogs.com/releases/2801152",type:"release",id:2801152},{comment:"",display_title:"Bright Eyes - Cassadaga",uri:"http://www.discogs.com/Bright-Eyes-Cassadaga/release/1072913",image_url:"",resource_url:"http://api.discogs.com/releases/1072913",type:"release",id:1072913},{comment:"",display_title:"Dear Nora - The New Year EP / Unreleased Songs",uri:"http://www.discogs.com/Dear-Nora-The-New-Year-EP-Unreleased-Songs/release/1709427",image_url:"",resource_url:"http://api.discogs.com/releases/1709427",type:"release",id:1709427},{comment:"",display_title:"Dear Nora - We'll Have A Time",uri:"http://www.discogs.com/Katy-Davidson-Well-Have-A-Time/release/2235401",image_url:"",resource_url:"http://api.discogs.com/releases/2235401",type:"release",id:2235401},{comment:"",display_title:"Ryan Adams - Heartbreaker",uri:"http://www.discogs.com/Ryan-Adams-Heartbreaker/release/1024037",image_url:"",resource_url:"http://api.discogs.com/releases/1024037",type:"release",id:1024037},{comment:"",display_title:"Casiotone For The Painfully Alone / Foot Foot - Casiotone For The Painfully Alone / Foot Foot",uri:"http://www.discogs.com/Casiotone-For-The-Painfully-Alone-Foot-Foot-Casiotone-For-The-Painfully-Alone-Foot-Foot/release/918039",image_url:"",resource_url:"http://api.discogs.com/releases/918039",type:"release",id:918039},{comment:"",display_title:"Merry Christmas - Her Exceptional Kindness",uri:"http://www.discogs.com/Merry-Christmas-Her-Exceptional-Kindness/release/3957497",image_url:"",resource_url:"http://api.discogs.com/releases/3957497",type:"release",id:3957497},{comment:"",display_title:"Bedhed / Merry Christmas - Bedhed/Merry Christmas Split",uri:"http://www.discogs.com/Bedhed-Merry-Christmas-BedhedMerry-Christmas-Split/release/4826198",image_url:"",resource_url:"http://api.discogs.com/releases/4826198",type:"release",id:4826198},{comment:"",display_title:"Jason Anderson - The Hopeful And The Unafraid",uri:"http://www.discogs.com/Jason-Anderson-The-Hopeful-And-The-Unafraid/release/1453368",image_url:"",resource_url:"http://api.discogs.com/releases/1453368",type:"release",id:1453368},{comment:"",display_title:"The Aislers Set - The Last Match",uri:"http://www.discogs.com/Aislers-Set-The-Last-Match/release/1505883",image_url:"",resource_url:"http://api.discogs.com/releases/1505883",type:"release",id:1505883},{comment:"",display_title:"Belle And Sebastian* - If You're Feeling Sinister",uri:"http://www.discogs.com/Belle-And-Sebastian-If-Youre-Feeling-Sinister/release/378895",image_url:"",resource_url:"http://api.discogs.com/releases/378895",type:"release",id:378895},{comment:"",display_title:"My Bloody Valentine - Loveless",uri:"http://www.discogs.com/My-Bloody-Valentine-Loveless/release/84825",image_url:"",resource_url:"http://api.discogs.com/releases/84825",type:"release",id:84825},{comment:"",display_title:"Townes Van Zandt - Townes Van Zandt",uri:"http://www.discogs.com/Townes-Van-Zandt-Townes-Van-Zandt/master/36824",image_url:"",resource_url:"http://api.discogs.com/masters/36824",type:"master",id:36824},{comment:"",display_title:"Townes Van Zandt - Live At The Old Quarter, Houston, Texas",uri:"http://www.discogs.com/Townes-Van-Zandt-Live-At-The-Old-Quarter-Houston-Texas/master/36810",image_url:"",resource_url:"http://api.discogs.com/masters/36810",type:"master",id:36810},{comment:"",display_title:"Blaze Foley - Blaze Foley",uri:"http://www.discogs.com/Blaze-Foley-Blaze-Foley/release/2536416",image_url:"",resource_url:"http://api.discogs.com/releases/2536416",type:"release",id:2536416},{comment:"",display_title:"The Velvet Underground - The Velvet Underground",uri:"http://www.discogs.com/The-Velvet-Underground-The-Velvet-Underground/master/35375",image_url:"",resource_url:"http://api.discogs.com/masters/35375",type:"master",id:35375},{comment:"",display_title:"Guided By Voices - Bee Thousand",uri:"http://www.discogs.com/Guided-By-Voices-Bee-Thousand/master/55972",image_url:"",resource_url:"http://api.discogs.com/masters/55972",type:"master",id:55972},{comment:"",display_title:"Guided By Voices - Alien Lanes",uri:"http://www.discogs.com/Guided-By-Voices-Alien-Lanes/master/55999",image_url:"",resource_url:"http://api.discogs.com/masters/55999",type:"master",id:55999},{comment:"",display_title:"Guided By Voices - Under The Bushes Under The Stars",uri:"http://www.discogs.com/Guided-By-Voices-Under-The-Bushes-Under-The-Stars/master/125525",image_url:"",resource_url:"http://api.discogs.com/masters/125525",type:"master",id:125525},{comment:"",display_title:"Guided By Voices - Do The Collapse",uri:"http://www.discogs.com/Guided-By-Voices-Do-The-Collapse/master/56004",image_url:"",resource_url:"http://api.discogs.com/masters/56004",type:"master",id:56004},{comment:"",display_title:"Guided By Voices - Isolation Drills",uri:"http://www.discogs.com/Guided-By-Voices-Isolation-Drills/master/114711",image_url:"",resource_url:"http://api.discogs.com/masters/114711",type:"master",id:114711},{comment:"",display_title:"David Bowie - Hunky Dory",uri:"http://www.discogs.com/David-Bowie-Hunky-Dory/master/1718",image_url:"",resource_url:"http://api.discogs.com/masters/1718",type:"master",id:1718},{comment:"",display_title:"Teenage Fanclub - Grand Prix",uri:"http://www.discogs.com/Teenage-Fanclub-Grand-Prix/master/6084",image_url:"",resource_url:"http://api.discogs.com/masters/6084",type:"master",id:6084},{comment:"",display_title:"Teenage Fanclub - Bandwagonesque",uri:"http://www.discogs.com/Teenage-Fanclub-Bandwagonesque/master/6041",image_url:"",resource_url:"http://api.discogs.com/masters/6041",type:"master",id:6041},{comment:"",display_title:"Teenage Fanclub - Songs From Northern Britain",uri:"http://www.discogs.com/Teenage-Fanclub-Songs-From-Northern-Britain/master/6088",image_url:"",resource_url:"http://api.discogs.com/masters/6088",type:"master",id:6088},{comment:"",display_title:"Ovens - Ovens",uri:"http://www.discogs.com/Ovens-Ovens/release/2947885",image_url:"",resource_url:"http://api.discogs.com/releases/2947885",type:"release",id:2947885},{comment:"",display_title:"Tony Molina - Dissed And Dismissed",uri:"http://www.discogs.com/Tony-Molina-Dissed-And-Dismissed/master/656494",image_url:"",resource_url:"http://api.discogs.com/masters/656494",type:"master",id:656494},{comment:"",display_title:"Joyce Manor - Never Hungover Again",uri:"http://www.discogs.com/Joyce-Manor-Never-Hungover-Again/master/710351",image_url:"",resource_url:"http://api.discogs.com/masters/710351",type:"master",id:710351},{comment:"",display_title:"Joyce Manor - Cody",uri:"http://www.discogs.com/Joyce-Manor-Cody/master/1070133",image_url:"",resource_url:"http://api.discogs.com/masters/1070133",type:"master",id:1070133},{comment:"",display_title:"Toys That Kill - Shanked",uri:"http://www.discogs.com/Toys-That-Kill-Shanked/master/422311",image_url:"",resource_url:"http://api.discogs.com/masters/422311",type:"master",id:422311},{comment:"",display_title:"The Underground Railroad To Candyland - Bird Roughs",uri:"http://www.discogs.com/Underground-Railroad-To-Candyland-Bird-Roughs/master/408234",image_url:"",resource_url:"http://api.discogs.com/masters/408234",type:"master",id:408234},{comment:"",display_title:"The Sidekicks - Runners In The Nerved World",uri:"http://www.discogs.com/Sidekicks-Runners-In-The-Nerved-World/master/808044",image_url:"",resource_url:"http://api.discogs.com/masters/808044",type:"master",id:808044},{comment:"",display_title:"The Weakerthans - Reunion Tour",uri:"http://www.discogs.com/Weakerthans-Reunion-Tour/master/104979",image_url:"",resource_url:"http://api.discogs.com/masters/104979",type:"master",id:104979},{comment:"",display_title:"The Replacements - Tim",uri:"http://www.discogs.com/The-Replacements-Tim/master/16203",image_url:"",resource_url:"http://api.discogs.com/masters/16203",type:"master",id:16203},{comment:"",display_title:"Big Star - #1 Record",uri:"http://www.discogs.com/Big-Star-1-Record/master/13825",image_url:"",resource_url:"http://api.discogs.com/masters/13825",type:"master",id:13825},{comment:"",display_title:"Mike Adams At His Honest Weight - Best Of Boiler Room Classics",uri:"http://www.discogs.com/Mike-Adams-At-His-Honest-Weight-Best-Of-Boiler-Room-Classics/master/718330",image_url:"",resource_url:"http://api.discogs.com/masters/718330",type:"master",id:718330},{comment:"",display_title:"Thin Lizzy - Bad Reputation",uri:"http://www.discogs.com/Thin-Lizzy-Bad-Reputation/master/52835",image_url:"",resource_url:"http://api.discogs.com/masters/52835",type:"master",id:52835}];

    listOutAlbums(hardcodedAlbumArray);
  });
              
            
!
999px

Console