cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <input type="checkbox" name="dialog_state" id="dialog_state" class="dialog_state">
<div id='dialog'>
  <label id="dlg-back" for="dialog_state"></label>
  <div id='dlg-wrap'>
    <label id="dlg-close" for="dialog_state"><i class="icon ion-ios-close-empty"></i></label>
    <h2 id='dlg-header'>Are you sure?</h2>
    <div id='dlg-content'>You are about to kill a puppy, that's some serious shit. Have you really thought this through?</div>
    <div id='dlg-prompt'>
      <div class='button positive'><i class="icon ion-ios-checkmark-empty"></i> Yes, let's do it!</div>
      <div class='button'><i class="icon ion-ios-close-empty"></i> No, I'll reconsider</div>
    </div>
  </div>
</div>
<main id='main' class='main_area'>
  <div class='center'>
    <label class="button" for="dialog_state"><i class="icon ion-ios-upload-outline
      "></i> Open the dialog</label>
  </div>
<div id='console'></div>
</main>
            
          
!
            
              #console {display: none;}
#dialog {
  position: absolute;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.15);
  transition: visibility 0s linear 0.5s,opacity 0.5s linear;
  opacity: 0;
  visibility: hidden;
}
.dialog_state {
  visibility: hidden;
  opacity: 0;
  display: none;
}
.dialog_state:checked + #dialog,
#dialog.dialog_open {
  transition-delay:0s;
  opacity: 1;
  visibility: visible;
}
#dlg-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
}
.dialog_state:checked + #dialog #dlg-wrap {
  max-height: 24rem;
  opacity: 1;
  padding: 2rem;
}
#dlg-wrap {
  position: relative;
  z-index: 1;
  display: block;
  box-sizing: border-box;
  margin: 0 auto;
  top: 50%;
  transform: translateY(-50%);
  width: 640px;
  padding: 2rem;
  border-radius: 0.25rem;
  /*border: 1px solid #969696;*/
  background: #fff;
  box-shadow: 1px 1px 6px rgba(0,0,0,0.3);
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition: all .5s;
}
#dlg-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 2rem;
  height: 2rem;
  line-height: 2rem;
  text-align: center;
  cursor: pointer;
}
h2#dlg-header {
  font: 200 2em/1em Raleway, Open Sans, Arial, Sans-Serif;
  text-transform: initial;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}
#dlg-content {
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.015em;
}
#dlg-prompt .button {
  margin: 1rem 0.5rem;
  border-radius: 1.5rem;
}



.main_area {
  transition: all 0.5s ease-out;
}
.dialog_state:checked ~ .main_area,
.main_area.dialog_open {
  filter: blur(6px);
}

.button, a.button {
  display: inline-block;
  padding: 0.25em 1em;
  box-sizing: border-box;
  
  background: #ffffff;
  color: #606060;
  text-decoration: none;
  letter-spacing: 0.075em;
  line-height: 2rem;
  font-family: Raleway, Open Sans, Arial;
  font-weight: 300;
  font-size: 0.85em;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  
  transition: .1s all;
  cursor: pointer;
}
.button:hover, a.button:hover {
  color: #a0a0a0;
  background: #f8f8f8;
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
  /*transform: scale(1.01);*/
}
.button.positive, a.button.positive {
  border-color: #6199B7;
  color: #6199B7;
}
.button.positive:hover, a.button.positive:hover {
  border-color: #468FB6;
  color: #fff;
  background-color: #468FB6;
}

.icon {
  vertical-align: middle;
  line-height: inherit;
  font-size: 1.75em;
}

body {
  font: 400 16px/1.65em Open Sans, Arial, Sans-Serif;
  letter-spacing: -0.015em;
  color: #303030;
  text-align: center;
}
#main {
  height: 100vh;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  background: url("https://farm6.staticflickr.com/5688/21515632899_94e4ddb78a_o.jpg") no-repeat center center;
  background-size: cover;
}
#main .center {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
}
h1 {
  font: 900 6.4em/1em Raleway, Open Sans, Arial, Sans-Serif;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  margin: 2rem 0 0.5rem;
}
h2 {
  font: 800 2em/1em Raleway, Open Sans, Arial, Sans-Serif;
  text-transform: uppercase;
  letter-spacing: 0.0em;
  margin: 2rem 0 0.5rem;
}


/* Console */
#console {position: absolute;bottom: 0;left: 0;width: 100%;height: 100px;box-sizing: border-box;background: #f0f0f0;color: #606060;font: 400 13px/16px Open Sans;letter-spacing: 0em;text-align: left;padding: 2px;overflow-y: scroll;0 } #console p {margin: 0; padding: 0;} #console p em {font-style: none;font-weight: 700;}
            
          
!
            
              $(function(){
  $(document).keypress(function(e) {
    cwrite(e.which,'Keypress event');
    if(e.which==120) custom_dialog_toggle('Keypress x','You opened this window by pressing x');
  });
});
function custom_dialog_toggle(title,text,buttons) {
  if(typeof title !=='undefined') $('#dlg-header').html(title);
  if(typeof text !=='undefined') $('#dlg-content').html(text);
  cwrite('Current state: '+$('#dialog_state').prop("checked"),'custom_dialog_toggle');
  $('#dialog_state').prop("checked", !$('#dialog_state').prop("checked"));
}
// Console logging function for debugging
// cwrite(str, title)
//      str:              string to be appended to console
//      title (optional): title of the string
// (c)  Tuomas Hatakka 2015
//      http://tuomashatakka.fi
function cwrite(str,title) {
  var ce = $('#console');
  var sg = "<p>";
  if(typeof title !=='undefined') sg = sg+"<em>"+title+"</em> ";
  sg = sg+str+"</p>";
  ce.prepend(sg);
  //if(ce.children("p").length>6) ce.children("p").first().remove();
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console