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>
    <h1>Gridvent 2017</h1>
    </header>
    
     <ul>
         <li class="day1">
             <a href="#" data-popup-open="popup-1">01</a>
             <ul>
                 <li class="popup" data-popup="popup-1"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-1">X</a>
                         <h2>Day 01</h2>
                         <p>Let’s get straight into code: the <a href="https://www.codecademy.com/courses/learn-css-grid/lessons/css-grid-i/exercises/grid-intro" target="_blank">CodeAcademy grid tutorial</a> will take you through key concepts of CSS grids.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day2">
             <a href="#" data-popup-open="popup-2">02</a>
             <ul>
                 <li class="popup" data-popup="popup-2"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-2">X</a>
                         <h2>Day 02 </h2>
                         <p>OK, you have seen some of the code. So <a href="https://designschool.canva.com/blog/grid-design/" target="_blank">why would we design on a grid?</a></p>
                     </span></li>
             </ul>
         </li>
         <li class="day3">
             <a href="#" data-popup-open="popup-3">03</a>
             <ul>
                 <li class="popup" data-popup="popup-3"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-3">X</a>
                         <h2>Day 03 </h2>
                         <p>But we already design on grids, don’t we? Well… sort of, but <a href="https://www.relay.fm/presentable/28" target="_blank">everything you know about web design changed last March</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day4">
             <a href="#" data-popup-open="popup-4">04</a>
             <ul>
                 <li class="popup" data-popup="popup-4"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-4">X</a>
                         <h2>Day 04 </h2>
                         <p>We’ve done terrible things, because we were left waiting for this moment&mdash;<a href="https://thehistoryoftheweb.com/tables-layout-absurd/" target="_blank">like all those years when we used and abused tables</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day5">
             <a href="#" data-popup-open="popup-5">05</a>
             <ul>
                 <li class="popup" data-popup="popup-5"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-5">X</a>
                         <h2>Day 05 </h2>
                         <p><a href="https://internetingishard.com/html-and-css/floats/" target="_blank">We told ourselves for a long time that we could use floats</a>, and that that we were doing it right. We were pleased we got over the tables thing.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day6">
             <a href="#" data-popup-open="popup-6">06</a>
             <ul>
                 <li class="popup" data-popup="popup-6"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-6">X</a>
                         <h2>Day 06 </h2>
                         <p>We knew it wasn’t right, but we built tools to survive&mdash;<a href="https://www.keycdn.com/blog/front-end-frameworks/" target="_blank">front-end frameworks</a> all feature grid systems which provide us with ready to go CSS-hack-grids.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day7">
             <a href="#" data-popup-open="popup-7">07</a>
             <ul>
                 <li class="popup" data-popup="popup-7"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-7">X</a>
                         <h2>Day 07 </h2>
                         <p>Those frameworks though&mdash;they can be a pain to work with and <a href="https://hacks.mozilla.org/2016/04/you-might-not-need-a-css-framework/" target="_blank">you might not need a CSS framework at all</a> if you could just solve your layout woes.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day8">
             <a href="#" data-popup-open="popup-8">08</a>
             <ul>
                 <li class="popup" data-popup="popup-8"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-8">X</a>
                         <h2>Day 08 </h2>
                         <p><a href="https://960.gs" target="_blank">Of course, we had some frameworks that were grid-first</a>, where the <i>whole product</i> was the grid.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day9">
             <a href="#" data-popup-open="popup-9">09</a>
             <ul>
                 <li class="popup" data-popup="popup-9"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-9">X</a>
                         <h2>Day 09 </h2>
                         <p>Some of those grid frameworks took us full circle,  <a href="http://chrisnager.com/ungrid/" target="_blank">back to (mis)using tables</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day10">
             <a href="#" data-popup-open="popup-10">10</a>
             <ul>
                 <li class="popup" data-popup="popup-10"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-10">X</a>
                         <h2>Day 10 </h2>
                         <p>For a while there, the bleeding edge idea was to use flexbox for grids, but that <a href="https://rachelandrew.co.uk/archives/2016/03/30/should-i-use-grid-or-flexbox/" target="_blank">wasn’t really what flexbox was for at all</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day11">
             <a href="#" data-popup-open="popup-11">11</a>
             <ul>
                 <li class="popup" data-popup="popup-11"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-11">X</a>
                         <h2>Day 11 </h2>
                         <p>If you want to go deep, read the <a href="https://www.w3.org/TR/css-grid-1/" target="_blank">full spec</a> of CSS grid.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day12">
             <a href="#" data-popup-open="popup-12">12</a>
             <ul>
                 <li class="popup" data-popup="popup-12"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-12">X</a>
                         <h2>Day 12 </h2>
                         <p>On the lighter side of things, <a href="http://cssgridgarden.com" target="_blank">Grid Garden is a game for learning CSS grid layout</a>&mdash;it's a fun way of bringing the code to life.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day13">
             <a href="#" data-popup-open="popup-13">13</a>
             <ul>
                 <li class="popup" data-popup="popup-13"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-13">X</a>
                         <h2>Day 13 </h2>
                         <p>Things I’ve learned about CSS Grid, No. 1: I’ve taught undergraduate students about front-end design since 2002, and for upcoming designers this is the most intuitive layout technique to learn.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day14">
             <a href="#" data-popup-open="popup-14">14</a>
             <ul>
                 <li class="popup" data-popup="popup-14"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-14">X</a>
                         <h2>Day 14 </h2>
                         <p>Rachel Andrew’s <a href="https://gridbyexample.com/patterns/" target="_blank">Grid by Example</a> demonstrates most parts of spec and offers loads of cut and keep patterns. Essential.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day15">
             <a href="#" data-popup-open="popup-15">15</a>
             <ul>
                 <li class="popup" data-popup="popup-15"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-15">X</a>
                         <h2>Day 15 </h2>
                         <p>CSS Tricks are my go to trusted source for clean and correct tutorials, so their <a href="https://css-tricks.com/snippets/css/complete-guide-grid/" target="_blank">Complete Guide to Grid</a> is a must read and a valuable resource to have on hand while working through your first projects.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day16">
             <a href="#" data-popup-open="popup-16">16</a>
             <ul>
                 <li class="popup" data-popup="popup-16"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-16">X</a>
                         <h2>Day 16 </h2>
                         <p>Things I’ve learned about CSS Grid, No. 2: those learning grid need to be canny web searchers, as there is a huge conversation about grids and CSS which predates CSS grid and is at best unhelpful.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day17">
             <a href="#" data-popup-open="popup-17">17</a>
             <ul>
                 <li class="popup" data-popup="popup-17"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-17">X</a>
                         <h2>Day 17 </h2>
                         <p><a href="https://blog.hubspot.com/marketing/web-design-history" target="_blank">Specs and tech shape our aesthetics</a>. We don’t know what a CSS grid based web looks like yet.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day18">
             <a href="#" data-popup-open="popup-18">18</a>
             <ul>
                 <li class="popup" data-popup="popup-18"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-18">X</a>
                         <h2>Day 18 </h2>
                         <p><a href="http://labs.jensimmons.com"target="_blank">Jen Simmons has done some great demos of striking visual design using CSS grid</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day19">
             <a href="#" data-popup-open="popup-19">19</a>
             <ul>
                 <li class="popup" data-popup="popup-19"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-19">X</a>
                         <h2>Day 19 </h2>
                         <p>Things I’ve learned about CSS Grid, No. 3: it’s obvious really but I realised when building this that a UL displayed as a grid retains its default padding and will need to be reset :&#41;</p>
                     </span></li>
             </ul>
         </li>
         <li class="day20">
             <a href="#" data-popup-open="popup-20">20</a>
             <ul>
                 <li class="popup" data-popup="popup-20"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-20">X</a>
                         <h2>Day 20 </h2>
                         <p>It’s important to know the spec but it’s also important to <a href="http://amzn.to/2BB9rOu" target="_blank">think about the actual design of grids</a>.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day21">
             <a href="#" data-popup-open="popup-21">21</a>
             <ul>
                 <li class="popup" data-popup="popup-21"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-21">X</a>
                         <h2>Day 21 </h2>
                         <p>Formalism in design is <i>great</i> but your grids will really get exciting when you <a href="http://amzn.to/2BwB0Zc" target="_blank">start breaking them</a></p>
                     </span></li>
             </ul>
         </li>
         <li class="day22">
             <a href="#" data-popup-open="popup-22">22</a>
             <ul>
                 <li class="popup" data-popup="popup-22"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-22">X</a>
                         <h2>Day 22 </h2>
                         <p>Things I’ve learned about CSS Grid, No. 4: grid-gap seems to work differently between Safari and Chrome ¯\_(ツ)_/¯</p>
                     </span></li>
             </ul>
         </li>
         <li class="day23">
             <a href="#" data-popup-open="popup-23">23</a>
             <ul>
                 <li class="popup" data-popup="popup-23"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-23">X</a>
                         <h2>Day 23 </h2>
                         <p>If you’re worried about pushing a grid project to production <a href="https://hacks.mozilla.org/2016/08/using-feature-queries-in-css/" target="_blank">you can use feature queries in CSS</a> to make a solid non-grid fallback.</p>
                     </span></li>
             </ul>
         </li>
         <li class="day24">
             <a href="#" data-popup-open="popup-24">24</a>
             <ul>
                 <li class="popup" data-popup="popup-24"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-24">X</a>
                         <h2>Day 24 </h2>
                         <p>By now you probably won’t be surprised to learn that Rachel Andrew has written <i>the</i> book on CSS Grid&mdash;it’s published by <a href="https://abookapart.com/products/the-new-css-layout" target="_blank">A Book Apart</a></p>
                     </span></li>
             </ul>
         </li>
         <li class="day25">
             <a href="#" data-popup-open="popup-25">25</a>
             <ul>
                 <li class="popup" data-popup="popup-25"><span class="close modaltext">
                         <a href="#" class="popup-close" data-popup-close="popup-25">X</a>
                         <h2>Happy Gridmas!</h2>
                         <p><a href="https://rachelandrew.co.uk/archives/2017/07/04/is-it-really-safe-to-start-using-css-grid-layout/" target="_blank">Is it really safe to start using CSS Grid Layout?</a>. tl;dr: yes, yes it is.</p>
                     </span></li>
             </ul>
         </li>
     </ul>

<!-- I used Emmet to the empty doors.
    
    This would generate just 25 numbered list items 

    ul>.day$<a>{$$}</a>*25
    
    But this is what I used to generate 25 list items populated with child LIs with some placholder content and all the class names I needed for the Javascript
    
    ul>li.day$*25>a[href="#" data-popup-open="popup-$"]{$$}+ul>li.popup[data-popup="popup-$"]>span.close>a.popup-close[data-popup-close="popup-$" href="#"]{X}+h2{Day $$ Title}+p{It's day $$!}
   
   -->

    <footer>
        <p>Image <a href="https://www.flickr.com/photos/tim_ellis/4166926375/in/photolist-7mdA3c-7mdcyp-aV26Lk-hvsNtd-hvsLTQ-hvu6px-aFg6XH-8TbnAE-hvu8eV-7iYZ1h-5Lhii7-7kFg34-imPJSE-7mdoDp-hvsovH-7iYY2f-aJEkrD-dtjs27-i1Wpvg-PLb1G-oBa4C-7ZecK-aUxWYF-5F9w5b-8T8guD-aCGRZd-aUxYG6-4amXno-aFjVh5-7iYXBm-7mdicB-7iV46n-7iYZsQ-itN7ig-7iV8fn-8Yt7EF-aQeYKi-qcniQM-imCno6-7kFj3p-8TszdW-dt22KM-7mFf3i-4cwGML-48C2M2-214GF3y-4iHagx-qsdyVt-7gXfcm-717hL">CC Tim Ellis</a>. | Made by <a href="http://www.twitter.com/jonhickman">Jon</a> for <a href="https://twitter.com/iamsteadman">Mark</a> as part of the podcast <a href="http://thread.fm">Thread</a>: <a href="http://thread.fm/e/35ac386bb51230/">The original challenge</a>, <a href="http://thread.fm/e/35b113383d3ca6/">the discussion of grids and advent calendars generally</a>.</p> 
    </footer>
              
            
!

CSS

              
                /* here's the grid! */

ul {
   
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* would be nice to work on a way to make these square */
    grid-template-rows: repeat(7, auto);
    padding-left: 0;
    grid-gap: 1vh;
    grid-row-gap: 1vh
    
}


li {
    display: inline-block;
    padding: 1vw;
}

/* 

grid-area positions are declared in this order: row-start / col-start / row-end / col-end;

I have 6 rows and 4 cols 

I might try to make SASS randomise these grid positions for me as this was a bloody bore to do manually.

See bottom of file for all boxes in order

*/

.day6 {
  grid-area: 1 / 1 / 2 / 2;
}

.day7 {
  grid-area: 1 / 2 / 2 / 3;
}

.day20 {
  grid-area: 1 / 3 / 2 / 4;
}

.day15 {
  grid-area: 1 / 4 / 2 / 5;
}

.day1 {
  grid-area: 2 / 1 / 3 / 2;
}

.day5 {
  grid-area: 2 / 2 / 3 / 3;
}

.day21 {
  grid-area: 2 / 3 / 3 / 4;
}

.day8 {
  grid-area: 2 / 4 / 3 / 5;
}

.day19 {
  grid-area: 3 / 1 / 4 / 2;
}

.day11 {
  grid-area: 3 / 2 / 4 / 3;
}

.day4 {
  grid-area: 3 / 3 / 4 / 4;
}

.day9 {
  grid-area: 3 / 4 / 4 / 5;
}

.day18 {
  grid-area: 4 / 1 / 5 / 2;
}

.day16 {
  grid-area: 4 / 2 / 5 / 3;
}

.day10 {
  grid-area: 4 / 3 / 5 / 4;
}

.day14 {
  grid-area: 4 / 4 / 5 / 5;
}

.day3 {
  grid-area: 5 / 1 / 6 / 2;
}

.day13 {
  grid-area: 5 / 2 / 6 / 3;
}

.day22 {
  grid-area: 5 / 3 / 6 / 4;
}

.day24 {
  grid-area: 5 / 4 / 6 / 5;
}

.day17 {
  grid-area: 6 / 1 / 7 / 2;
}

.day23 {
  grid-area: 6 / 2 / 7 / 3;
}

.day2 {
  grid-area: 6 / 3 / 7 / 4;
}

.day12 {
  grid-area: 6 / 4 / 7 / 5;
}

.day25 {grid-column: span 4;}

/* here's the styling! */

body {
    background: url('http://www.theplan.co.uk/gridvent/background.jpg') #d42426; 
    background-size: cover;
    background-repeat: no-repeat;
    font-family: 'Open Sans', sans-serif;
} 
/* add a gradient for longer screens */ 
/* review typography */

footer {
    font-size: 0.5em;
    color: white;
    clear: both;    
} /*review typography*/

footer a, footer a:hover, footer a:visited, footer a:active {
    color: white;
}

h1 {
    color: white;
    margin-bottom: 0.25rem;
    font-family: 'Yesteryear', cursive;
    font-size: 6vh;
    text-shadow: 4px 4px 1px rgba(212, 36, 38, 0.3); /* #d42426 in rgba */
    text-align: center;
} /*review typography*/

ul {
    
}

/* Doors */
li {
    color: white;
    text-align: right;
    border: dashed rgba(100,100,100,0.2) 1px;
}

body>ul>li {
    padding: 0px;
    background-color: rgba(100,100,100,0.0);
}

body>ul>li:hover {
    background-color: rgba(100,100,100,0.2);
}
li > a, li > a:hover, li > a:visited, li > a:active {
    color: white;
    text-decoration: none;
}

li > a {
    display: block;
    padding: 5%;
    width: 90%;
    height: 90%;
}


/* Behind the doors (modals) */

li > ul > li {
    display: none;
    position: fixed;
    margin: auto;
    top: 0; 
    left: 0; 
    bottom: 0; 
    right: 0;
    width: 50vw;
    height: 50vh;
    background-color: white;
    border: double 4px black;
    color: black;
    text-align: left;
    padding: 4vw;
    box-shadow: 3px 3px 5px 1px rgba(0,0,0,0.2);
    overflow: auto;
}

.modaltext a, .modaltext a:hover, .modaltext a:visited, .modaltext a:active {
    text-decoration: none;
    color: #d42426;
}

.modaltext a:hover {
    text-decoration: underline; color: black;
}


/* the modal close button */

.popup-close {
    position: absolute;
    right: 20px;
    top: 20px;
} 


a.popup-close, a:visited.popup-close, a:active.popup-close    {
    color:black;
    text-decoration: none;
}
a:hover.popup-close {
    text-decoration: underline;
    color: #d42426;
}

/* end of styles for close button */

/* These are the unshuffled boxes! */

/*.day1 {
  grid-area: 1 / 1 / 2 / 2;
}

.day2 {
  grid-area: 1 / 2 / 2 / 3;
}

.day3 {
  grid-area: 1 / 3 / 2 / 4;
}

.day4 {
  grid-area: 1 / 4 / 2 / 5;
}

.day5 {
  grid-area: 2 / 1 / 3 / 2;
}

.day6 {
  grid-area: 2 / 2 / 3 / 3;
}

.day7 {
  grid-area: 2 / 3 / 3 / 4;
}

.day8 {
  grid-area: 2 / 4 / 3 / 5;
}

.day9 {
  grid-area: 3 / 1 / 4 / 2;
}

.day10 {
  grid-area: 3 / 2 / 4 / 3;
}

.day11 {
  grid-area: 3 / 3 / 4 / 4;
}

.day12 {
  grid-area: 3 / 4 / 4 / 5;
}

.day13 {
  grid-area: 4 / 1 / 5 / 2;
}

.day14 {
  grid-area: 4 / 2 / 5 / 3;
}

.day15 {
  grid-area: 4 / 3 / 5 / 4;
}

.day16 {
  grid-area: 4 / 4 / 5 / 5;
}

.day17 {
  grid-area: 5 / 1 / 6 / 2;
}

.day18 {
  grid-area: 5 / 2 / 6 / 3;
}

.day19 {
  grid-area: 5 / 3 / 6 / 4;
}

.day20 {
  grid-area: 5 / 4 / 6 / 5;
}

.day21 {
  grid-area: 6 / 1 / 7 / 2;
}

.day22 {
  grid-area: 6 / 2 / 7 / 3;
}

.day23 {
  grid-area: 6 / 3 / 7 / 4;
}

.day24 {
  grid-area: 6 / 4 / 7 / 5;
}

.day25 {grid-column: span 4;} */


              
            
!

JS

              
                    //----- adapted from http://inspirationalpixels.com/tutorials/custom-popup-modal
    
$(function() {
    //----- OPEN
    
    //-- This has been added to the original Insprational Pixels code. The modal leaves some doors visble and they can be clicked on. Without this function, previously opened modals stay visible until closedusing their pop-close link. Modals stack from the first in the code, so in this case door 25 has the highest z-index. If the user has opened door 25, clicking on any other doors will load the relevant modal underneath number 25. This fucntion clears that by closing _all_ modals which are open. The script then moves on to open the requested modal. As one modal fades in and one fades out, the rendered effect is a nice cross-fade 
    
    $('[data-popup-open]').on('click', function(e)  {
        var targeted_popup_class = jQuery(this).attr('data-popup-open');
        $('.popup').fadeOut(350);
 
        e.preventDefault();
    });
    $('[data-popup-open]').on('click', function(e)  {
        var targeted_popup_class = jQuery(this).attr('data-popup-open');
        $('[data-popup="' + targeted_popup_class + '"]').fadeIn(350);
 
        e.preventDefault();
    });
 
    //----- CLOSE
    $('[data-popup-close]').on('click', function(e)  {
        var targeted_popup_class = jQuery(this).attr('data-popup-close');
        $('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);
 
        e.preventDefault();
    });
});
              
            
!
999px

Console