Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <input type="radio" name="filters" id="contains" checked="checked"/>
<input type="radio" name="filters" id="starts-with"/>
<input type="radio" name="filters" id="ends-with"/>
<input type="radio" name="a1" id="a1nil" checked="checked"/>
<input type="radio" name="a1" id="a1q"/>
<input type="radio" name="a1" id="a1w"/>
<input type="radio" name="a1" id="a1e"/>
<input type="radio" name="a1" id="a1r"/>
<input type="radio" name="a1" id="a1t"/>
<input type="radio" name="a1" id="a1y"/>
<input type="radio" name="a1" id="a1u"/>
<input type="radio" name="a1" id="a1i"/>
<input type="radio" name="a1" id="a1o"/>
<input type="radio" name="a1" id="a1p"/>
<input type="radio" name="a1" id="a1a"/>
<input type="radio" name="a1" id="a1s"/>
<input type="radio" name="a1" id="a1d"/>
<input type="radio" name="a1" id="a1f"/>
<input type="radio" name="a1" id="a1g"/>
<input type="radio" name="a1" id="a1h"/>
<input type="radio" name="a1" id="a1j"/>
<input type="radio" name="a1" id="a1k"/>
<input type="radio" name="a1" id="a1l"/>
<input type="radio" name="a1" id="a1z"/>
<input type="radio" name="a1" id="a1x"/>
<input type="radio" name="a1" id="a1c"/>
<input type="radio" name="a1" id="a1v"/>
<input type="radio" name="a1" id="a1b"/>
<input type="radio" name="a1" id="a1n"/>
<input type="radio" name="a1" id="a1m"/>
<input type="radio" name="a2" id="a2nil" checked="checked"/>
<input type="radio" name="a2" id="a2q"/>
<input type="radio" name="a2" id="a2w"/>
<input type="radio" name="a2" id="a2e"/>
<input type="radio" name="a2" id="a2r"/>
<input type="radio" name="a2" id="a2t"/>
<input type="radio" name="a2" id="a2y"/>
<input type="radio" name="a2" id="a2u"/>
<input type="radio" name="a2" id="a2i"/>
<input type="radio" name="a2" id="a2o"/>
<input type="radio" name="a2" id="a2p"/>
<input type="radio" name="a2" id="a2a"/>
<input type="radio" name="a2" id="a2s"/>
<input type="radio" name="a2" id="a2d"/>
<input type="radio" name="a2" id="a2f"/>
<input type="radio" name="a2" id="a2g"/>
<input type="radio" name="a2" id="a2h"/>
<input type="radio" name="a2" id="a2j"/>
<input type="radio" name="a2" id="a2k"/>
<input type="radio" name="a2" id="a2l"/>
<input type="radio" name="a2" id="a2z"/>
<input type="radio" name="a2" id="a2x"/>
<input type="radio" name="a2" id="a2c"/>
<input type="radio" name="a2" id="a2v"/>
<input type="radio" name="a2" id="a2b"/>
<input type="radio" name="a2" id="a2n"/>
<input type="radio" name="a2" id="a2m"/>
<input type="radio" name="a3" id="a3nil" checked="checked"/>
<input type="radio" name="a3" id="a3q"/>
<input type="radio" name="a3" id="a3w"/>
<input type="radio" name="a3" id="a3e"/>
<input type="radio" name="a3" id="a3r"/>
<input type="radio" name="a3" id="a3t"/>
<input type="radio" name="a3" id="a3y"/>
<input type="radio" name="a3" id="a3u"/>
<input type="radio" name="a3" id="a3i"/>
<input type="radio" name="a3" id="a3o"/>
<input type="radio" name="a3" id="a3p"/>
<input type="radio" name="a3" id="a3a"/>
<input type="radio" name="a3" id="a3s"/>
<input type="radio" name="a3" id="a3d"/>
<input type="radio" name="a3" id="a3f"/>
<input type="radio" name="a3" id="a3g"/>
<input type="radio" name="a3" id="a3h"/>
<input type="radio" name="a3" id="a3j"/>
<input type="radio" name="a3" id="a3k"/>
<input type="radio" name="a3" id="a3l"/>
<input type="radio" name="a3" id="a3z"/>
<input type="radio" name="a3" id="a3x"/>
<input type="radio" name="a3" id="a3c"/>
<input type="radio" name="a3" id="a3v"/>
<input type="radio" name="a3" id="a3b"/>
<input type="radio" name="a3" id="a3n"/>
<input type="radio" name="a3" id="a3m"/>
<nav>
  <h2>CSS Searching a Dataset with Filters</h2>
  <section class="alpha-1">
    <h1>Char 1</h1>
    <label for="a1nil">clear</label>
    <label for="a1q">q</label>
    <label for="a1w">w</label>
    <label for="a1e">e</label>
    <label for="a1r">r</label>
    <label for="a1t">t</label>
    <label for="a1y">y</label>
    <label for="a1u">u</label>
    <label for="a1i">i</label>
    <label for="a1o">o</label>
    <label for="a1p">p</label>
    <label for="a1a">a</label>
    <label for="a1s">s</label>
    <label for="a1d">d</label>
    <label for="a1f">f</label>
    <label for="a1g">g</label>
    <label for="a1h">h</label>
    <label for="a1j">j</label>
    <label for="a1k">k</label>
    <label for="a1l">l</label>
    <label for="a1z">z</label>
    <label for="a1x">x</label>
    <label for="a1c">c</label>
    <label for="a1v">v</label>
    <label for="a1b">b</label>
    <label for="a1n">n</label>
    <label for="a1m">m</label>
  </section>
  <section class="alpha-2">
    <h1>Char 2</h1>
    <label for="a2nil">clear</label>
    <label for="a2q">q</label>
    <label for="a2w">w</label>
    <label for="a2e">e</label>
    <label for="a2r">r</label>
    <label for="a2t">t</label>
    <label for="a2y">y</label>
    <label for="a2u">u</label>
    <label for="a2i">i</label>
    <label for="a2o">o</label>
    <label for="a2p">p</label>
    <label for="a2a">a</label>
    <label for="a2s">s</label>
    <label for="a2d">d</label>
    <label for="a2f">f</label>
    <label for="a2g">g</label>
    <label for="a2h">h</label>
    <label for="a2j">j</label>
    <label for="a2k">k</label>
    <label for="a2l">l</label>
    <label for="a2z">z</label>
    <label for="a2x">x</label>
    <label for="a2c">c</label>
    <label for="a2v">v</label>
    <label for="a2b">b</label>
    <label for="a2n">n</label>
    <label for="a2m">m</label>
  </section>
  <section class="alpha-3">
    <h1>Char 3</h1>
    <label for="a3nil">clear</label>
    <label for="a3q">q</label>
    <label for="a3w">w</label>
    <label for="a3e">e</label>
    <label for="a3r">r</label>
    <label for="a3t">t</label>
    <label for="a3y">y</label>
    <label for="a3u">u</label>
    <label for="a3i">i</label>
    <label for="a3o">o</label>
    <label for="a3p">p</label>
    <label for="a3a">a</label>
    <label for="a3s">s</label>
    <label for="a3d">d</label>
    <label for="a3f">f</label>
    <label for="a3g">g</label>
    <label for="a3h">h</label>
    <label for="a3j">j</label>
    <label for="a3k">k</label>
    <label for="a3l">l</label>
    <label for="a3z">z</label>
    <label for="a3x">x</label>
    <label for="a3c">c</label>
    <label for="a3v">v</label>
    <label for="a3b">b</label>
    <label for="a3n">n</label>
    <label for="a3m">m</label>
  </section>
  <section class="filters">
    <h1>Filters</h1>
    <label for="contains">contains</label>
    <label for="starts-with">starts with</label>
    <label for="ends-with">ends with</label>
  </section>
</nav>
<main>
  <h2><span id="f"></span><span class="quote"><span id="o1"></span><span id="o2"></span><span id="o3"></span></span></h2>
  <ul>
    <li dv="speech">speech</li>
    <li dv="buy">buy</li>
    <li dv="brand">brand</li>
    <li dv="empirical">empirical</li>
    <li dv="offspring">offspring</li>
    <li dv="like">like</li>
    <li dv="neutral">neutral</li>
    <li dv="crime">crime</li>
    <li dv="pneumonia">pneumonia</li>
    <li dv="aid">aid</li>
    <li dv="mold">mold</li>
    <li dv="accompany">accompany</li>
    <li dv="bin">bin</li>
    <li dv="pastel">pastel</li>
    <li dv="laundry">laundry</li>
    <li dv="producer">producer</li>
    <li dv="posture">posture</li>
    <li dv="throne">throne</li>
    <li dv="beef">beef</li>
    <li dv="colon">colon</li>
    <li dv="secretary">secretary</li>
    <li dv="reason">reason</li>
    <li dv="portrait">portrait</li>
    <li dv="sniff">sniff</li>
    <li dv="print">print</li>
    <li dv="quiet">quiet</li>
    <li dv="minister">minister</li>
    <li dv="break">break</li>
    <li dv="crown">crown</li>
    <li dv="edge">edge</li>
    <li dv="rebel">rebel</li>
    <li dv="case">case</li>
    <li dv="dance">dance</li>
    <li dv="disgrace">disgrace</li>
    <li dv="bottom">bottom</li>
    <li dv="merit">merit</li>
    <li dv="blade">blade</li>
    <li dv="frog">frog</li>
    <li dv="mourning">mourning</li>
    <li dv="member">member</li>
    <li dv="feel">feel</li>
    <li dv="bed">bed</li>
    <li dv="behead">behead</li>
    <li dv="organize">organize</li>
    <li dv="request">request</li>
    <li dv="service">service</li>
    <li dv="despise">despise</li>
    <li dv="glue">glue</li>
    <li dv="tribute">tribute</li>
    <li dv="east">east</li>
    <li dv="hotdog">hotdog</li>
    <li dv="rate">rate</li>
    <li dv="seat">seat</li>
    <li dv="soul">soul</li>
    <li dv="cook">cook</li>
    <li dv="inch">inch</li>
    <li dv="lily">lily</li>
    <li dv="week">week</li>
    <li dv="porter">porter</li>
    <li dv="silence">silence</li>
    <li dv="eject">eject</li>
    <li dv="contact">contact</li>
    <li dv="injury">injury</li>
    <li dv="stick">stick</li>
    <li dv="button">button</li>
    <li dv="resist">resist</li>
    <li dv="retailer">retailer</li>
    <li dv="dressing">dressing</li>
    <li dv="flight">flight</li>
    <li dv="volcano">volcano</li>
    <li dv="dream">dream</li>
    <li dv="money">money</li>
    <li dv="tourist">tourist</li>
    <li dv="leash">leash</li>
    <li dv="dare">dare</li>
    <li dv="candidate">candidate</li>
    <li dv="fish">fish</li>
    <li dv="analysis">analysis</li>
    <li dv="official">official</li>
    <li dv="reaction">reaction</li>
    <li dv="hostile">hostile</li>
    <li dv="just">just</li>
    <li dv="graze">graze</li>
    <li dv="bathtub">bathtub</li>
    <li dv="clear">clear</li>
    <li dv="captivate">captivate</li>
    <li dv="risk">risk</li>
    <li dv="dairy">dairy</li>
    <li dv="apathy">apathy</li>
    <li dv="say">say</li>
    <li dv="scratch">scratch</li>
    <li dv="passage">passage</li>
    <li dv="stress">stress</li>
    <li dv="village">village</li>
    <li dv="invite">invite</li>
    <li dv="route">route</li>
    <li dv="fool">fool</li>
    <li dv="accurate">accurate</li>
    <li dv="window">window</li>
    <li dv="betray">betray</li>
    <li dv="blue">blue</li>
    <li dv="abandon">abandon</li>
    <li dv="quest">quest</li>
    <li dv="beginning">beginning</li>
    <li dv="voucher">voucher</li>
    <li dv="cow">cow</li>
    <li dv="extract">extract</li>
    <li dv="trail">trail</li>
    <li dv="smile">smile</li>
    <li dv="useful">useful</li>
    <li dv="smash">smash</li>
    <li dv="red">red</li>
    <li dv="credit">credit</li>
    <li dv="instinct">instinct</li>
    <li dv="storage">storage</li>
    <li dv="brush">brush</li>
    <li dv="coverage">coverage</li>
    <li dv="oral">oral</li>
    <li dv="effort">effort</li>
    <li dv="compete">compete</li>
    <li dv="timber">timber</li>
    <li dv="flesh">flesh</li>
    <li dv="afford">afford</li>
    <li dv="filter">filter</li>
    <li dv="meadow">meadow</li>
    <li dv="nickel">nickel</li>
    <li dv="valid">valid</li>
    <li dv="coma">coma</li>
    <li dv="baseball">baseball</li>
    <li dv="encourage">encourage</li>
    <li dv="penetrate">penetrate</li>
    <li dv="bare">bare</li>
    <li dv="shine">shine</li>
    <li dv="finance">finance</li>
    <li dv="episode">episode</li>
    <li dv="honest">honest</li>
    <li dv="miner">miner</li>
    <li dv="vote">vote</li>
    <li dv="harass">harass</li>
    <li dv="crosswalk">crosswalk</li>
    <li dv="copper">copper</li>
    <li dv="magazine">magazine</li>
    <li dv="suffering">suffering</li>
    <li dv="moment">moment</li>
    <li dv="greet">greet</li>
    <li dv="practical">practical</li>
    <li dv="monarch">monarch</li>
    <li dv="bounce">bounce</li>
    <li dv="fun">fun</li>
    <li dv="workshop">workshop</li>
    <li dv="harvest">harvest</li>
    <li dv="plaster">plaster</li>
    <li dv="mars">mars</li>
  </ul>
</main>
              
            
!

CSS

              
                $filters: contains, starts-with, ends-with;
$alpha: nil,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
$words: 'speech','buy','brand','empirical','offspring','like','neutral','crime','pneumonia','aid','mold','accompany','bin','pastel','laundry','producer','posture','throne','beef','colon','secretary','reason','portrait','sniff','print','quiet','minister','break','crown','edge','rebel','case','dance','disgrace','bottom','merit','blade','frog','mourning','member','feel','bed','behead','organize','request','service','despise','glue','tribute','east','hotdog','rate','seat','soul','cook','inch','lily','week','porter','silence','eject','contact','injury','stick','button','resist','retailer','dressing','flight','volcano','dream','money','tourist','leash','dare','candidate','fish','analysis','official','reaction','hostile','just','graze','bathtub','clear','captivate','risk','dairy','apathy','say','scratch','passage','stress','village','invite','route','fool','accurate','window','betray','blue','abandon','quest','beginning','voucher','cow','extract','trail','smile','useful','smash','red','credit','instinct','storage','brush','coverage','oral','effort','compete','timber','flesh','afford','filter','meadow','nickel','valid','coma','baseball','encourage','penetrate','bare','shine','finance','episode','honest','miner','vote','harass','crosswalk','copper','magazine','suffering','moment','greet','practical','monarch','bounce','fun','workshop','harvest','plaster','mars';//,'protest','minute','makeup','diagram','cheek','flourish','revenge','wreck','clearance','entertain','lock','green','cluster','flower','private','proper','hole','agreement','see','dry','eternal','chain','cafe','ignorant','forge','mystery','spy','death','security','burial','collar','mess','cabin','plead','evening','bank','sculpture','vehicle','polish','rack','mechanism','content','lump','pride','deadly','widen','marriage','cigarette','stadium','stock','character','salon','industry','lose','ordinary','hunting','berry','stroll','price','pound','elegant','sit','keep','elapse','element','cherry','shoulder','pay','dominate','depend','workout','reduction','garage','sphere','ratio','ditch','value','ambition','pumpkin','miracle','estimate','agree','pier','pity','stand','abstract','gallery','context','stun','river','suspicion','energy','player','god','grateful','inflation','volunteer','limited','europe','scandal','vague','employee','theorist','intensify','lecture','tongue','mass','utter','pigeon','bridge','prize','meat','steel','similar','modest','clerk','pleasant','wild','mutter','economy','spin','motif','tool','delivery','parachute','session','swing','primary','orchestra','raid','variable','drug','score','reception','father','jam','movie','bulletin','salmon','cutting','goat','drawer','tease','export','pole','memory','bottle','large','tumble','reality','grant','nerve','detective','promote','fog','fireplace','reptile','tissue','will','enhance','harbor','influence','looting','scenario','cream','quantity','sting','fibre','birthday','pudding','advocate','domestic','central','rubbish','talk','dark','text','sofa','due','top','offensive','favorable','meet','fuss','quality','image','urine','deny','plaintiff','sickness','toll','round','lion','debt','spray','divide','native','snack','take','feminine','raw','squash','dollar','junior','tape','journal','express','poetry','donor','expect','spend','think','applaud','relate','edition','clue','academy','cage','president','cool','retreat','leader','whole','steak','proof','eyebrow','pour','champion','belly','way','sense','lean','justice','fare','monk','person','sail','priority','umbrella','project','winter','omission','sunrise','advice','platform','exemption';

$ones: null;
$twos: null;
$threes: null;

// we want to take a list, a string, a starting index and amount of chars to check
// if it is unique in the list, we add the sequence to the list
@function check-char($list, $string, $index, $amount) {
  // if we have enough chars for the desired amount left in the string
  @if str-length($string) >= ($index + $amount - 1) {
    // get the sequence of letters
    $seq: str-slice($string, $index, $index + $amount - 1);
    // if list isnt a list yet
    @if $list == null {
      // return a new list with the value
      @return ($seq);
    // else if it isnt in the list
    } @elseif index($list, $seq) == null { 
      // add it to the list
      @return append($list, $seq); 
    // else, ignore this sequence
    } @else {
      // return the original list
      @return $list;
    }
  // return null so we can ignore
  } @else {
    @return null;
  }
}

// thanks, hugo!
// https://css-tricks.com/snippets/sass/str-replace-function/
@function str-replace($string, $search, $replace: '') {
  $index: str-index($string, $search);
  @if $index {
    @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  }
  @return $string;
}

// for each word
@each $word in $words {
  // for each char
  @for $i from 1 through str-length($word) {
    // check the ones for that char
    $one: check-char($ones, $word, $i, 1);
    // check the twos for the two chars from this position
    $two: check-char($twos, $word, $i, 2);
    // check the threes for the three chars from this position
    $three: check-char($threes, $word, $i, 3);
    // if we got a new list from the function, set it
    @if $one != null { $ones: $one; }
    @if $two != null { $twos: $two; }
    @if $three != null { $threes: $three; }
  }
}

// deactivating second char menu
#a1nil:checked ~ nav section.alpha-2,
#a1nil:checked ~ nav section.alpha-3,
#a2nil:checked ~ nav section.alpha-3 { opacity: 0.2; pointer-events: none; }

// selected label states
%active-label { 
  background: #1A659E;
  color: white;
}

@mixin active-word {
  color: #1A659E; 
  background: white; 
  opacity: 1; 
  order: 1;
  box-shadow: 0px 1px 2px rgba(0,0,0,0.1);
}

// deactivating all li
li { 
  opacity: 0.2;
  order: 2; 
}

// showing all when no filter
#a1nil:checked ~ main li { @include active-word; }

// each filter
@each $filter in $filters {
  ##{$filter}:checked ~ nav [for="#{$filter}"] { @extend %active-label; }
  ##{$filter}:checked ~ main #f::before { content: "#{str-replace($filter, '-', ' ')} "; }
}

// each alpha
@each $char in $alpha {
  #a1#{$char}:checked ~ nav [for="a1#{$char}"],
  #a2#{$char}:checked ~ nav [for="a2#{$char}"],
  #a3#{$char}:checked ~ nav [for="a3#{$char}"] { @extend %active-label; }
  @if $char != 'nil' {
    #a1#{$char}:checked ~ main #o1::after,
    #a2#{$char}:checked ~ main #o2::after,
    #a3#{$char}:checked ~ main #o3::after {
      content: "#{$char}";
    }
  }
}

// extending ends up killing us, so the selectors are split up.
$sel: '';
@each $one in $ones {
  // first letter nil second
  $sel: $sel + '#contains:checked ~ #a1#{$one}:checked ~ #a2nil:checked ~ main [dv*="#{$one}"],';
  $sel: $sel + '#starts-with:checked ~ #a1#{$one}:checked ~ #a2nil:checked ~ main [dv^="#{$one}"],';
  $sel: $sel + '#ends-with:checked ~ #a1#{$one}:checked ~ #a2nil:checked ~ main [dv$="#{$one}"],';
}
@each $two in $twos {
  $char-1: str-slice($two, 1, 1);
  $char-2: str-slice($two, 2, 2);
  // active combinations
  $sel: $sel + '#contains:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3nil:checked ~ main [dv*="#{$two}"],';
  $sel: $sel + '#starts-with:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3nil:checked ~ main [dv^="#{$two}"],';
  $sel: $sel + '#ends-with:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3nil:checked ~ main [dv$="#{$two}"],';
}

// this is one large comma-separated selector, done for each first letter and its permutations.
// if we built one massive selector for everything, stuff stops working.
#{$sel} { @include active-word; }

// reset the selector
$sel: '';
@each $three in $threes {
  $char-1: str-slice($three, 1, 1);
  $char-2: str-slice($three, 2, 2);
  $char-3: str-slice($three, 3, 3);
  // active combinations
  $sel: $sel + '#contains:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3#{$char-3}:checked ~ main [dv*="#{$three}"],';
  $sel: $sel + '#starts-with:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3#{$char-3}:checked ~ main [dv^="#{$three}"],';
  $sel: $sel + '#ends-with:checked ~ #a1#{$char-1}:checked ~ #a2#{$char-2}:checked ~ #a3#{$char-3}:checked ~ main [dv$="#{$three}"],';
  // reset selector every 50 to split up the big one
  $index: index($threes, $three);
  @if $index % 50 == 0 {
    #{$sel} { @include active-word; }
    $sel: '';
  }
}

// clearing content on nil cases
@for $i from 1 through 3 {
  #a1nil:checked ~ main #o#{$i}::after { content: ""; }
}
// when 2 is nil and 3 is set
#a2nil:checked ~ main #o3::after { content: ""; }

// flexbox item gap
$gap: 4px;
$corner: 2px;

ul {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
  padding: 1rem 0 0;
  margin: 1rem 0 0;
  border-top: 1px solid #E0E0E0;
  transition: all 2s linear;
  height: 250px;
  overflow-y: auto;
  li {
    padding: 0.5rem;
    box-sizing: border-box;
    text-align: center;
    font-size: 0.8em;
    width: 100%;
    width: calc(50% - #{$gap});
    @media (min-width: 600px) {
      width: calc(20% - #{$gap});
    }
    @media (min-width: 900px) {
      width: calc(10% - #{$gap});
    }
    margin-left: $gap / 2;
    margin-right: $gap / 2;
    margin-bottom: $gap;
    border-radius: $corner;
    // since we adjust flex ordering, we cant cancel any margins based on nth
    // eg. margin-right: $gap; &:nth-child(10n + 10) { margin-right: 0; }
  }
}

h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.2rem;
  text-align: center;
}

h2 {
  text-align: center;
  margin: 0;
  margin-top: 1rem;
  .quote::before { content: "“"; }
  .quote::after { content: "”"; }
  .quote { display: inline-block; }
}

body {
  padding: 1rem;
  box-sizing: border-box;
  text-align: center;
  background: #444;
  color: #444;
}

input {
  display: inline-block;
  opacity: 0.5;
}

nav, main {
  padding: 1rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

main {
  background: #F9F9F9;
  border-top: 1px solid #E0E0E0;
  border-radius: 0px 0px $corner * 2 $corner * 2;
  // height: 400px;
  // overflow-y: auto;
}

nav {
  display: flex;
  flex-wrap: wrap;
  background: #FFF;
  margin: 2rem auto 0;
  border-radius: $corner * 2 $corner * 2 0px 0px;
  h2 {
    flex-basis: 100%;
    text-align: center;
    font-size: 2rem;
  }
  section {
    display: flex;
    width: 100%;
    @media (min-width: 740px) {
      width: 33.33%;
    }
    justify-content: space-between;
    flex-wrap: wrap;
    box-sizing: border-box;
    padding: 1rem;
    h1 { 
      width: 100%; 
    }
    label {
      padding: 0.5rem 0.125rem;
      text-align: center;
      box-sizing: border-box;
      cursor: pointer;
      background: #F0F0F0;
      border-radius: $corner;
      box-shadow: inset 0px 0px 0px 1px rgba(0,0,0,0.025);
      &:hover {
        background: #E9E9E9;
      }
      &[for$="nil"] { text-transform: uppercase; font-size: 0.7rem; }
    }
    &.filters { 
      width: 100%; 
      label {
        width: calc(33.33% - #{$gap});
        margin-right: $gap * 0.5;
        margin-left: $gap * 0.5;
        text-transform: uppercase; 
        font-size: 0.7rem;
      }
    }
    
    &[class^="alpha-"] {
      label {
        // first line, 10%
        flex-basis: calc(10% - #{$gap});
        margin-bottom: $gap;
        margin-right: $gap;
        box-sizing: border-box;
        // reset, full width
        &:first-of-type { flex-basis: 100%; margin-right: 0; }
        // keyboard layout
        &:nth-of-type(11) { margin-right: 0; }
        &:nth-of-type(12) { margin-left: calc(5% + #{$gap * 0.5}); }
        &:nth-of-type(20) { margin-right: calc(5% + #{$gap * 0.5}); }
        &:nth-of-type(21) { margin-left: calc(15% + #{$gap * 0.5}); }
        &:nth-of-type(27) { margin-right: calc(15% + #{$gap * 0.5}); }
      }
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console