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

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

              
                <div id="main">
</div>
              
            
!

CSS

              
                body {
  font-family: 'Rubik', sans-serif;
  margin: 0;
  height: 100%;
  line-height: 1.5;
}

html, #main {
  height: 100%;
}

.wrapper {
  position: relative;
  padding: 2rem;
  height: 100%;
}

.wrapper.overlay:before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: black;
  opacity: .6;
}

header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2rem;
}

a {
  color: #3a4483;
}
a:hover {
  color: #b04abc;
}

nav a {
  display: inline-block;
  margin: .5rem;
  font-size: 1.2rem;
  text-decoration: none;
}

nav a:hover, nav a:focus {
  text-decoration: underline;         
}

.modal.open {
  position: absolute;
  top: 5rem;
  bottom: 5rem;
  right: 5rem;
  left: 5rem;
  background-color: white;
  padding: 2rem;
}

button {
  font-family: 'Rubik', sans-serif;
  min-height: 2rem;
  background-color: pink;
  border: 1px solid hotpink;
  border-radius: 4px;
  font-size: 1rem;
}

button:hover, button:focus {
  background-color: black;
  color: pink;
}

*:focus {
  outline: 2px dashed hotpink;
  outline-offset: 2px;
}
              
            
!

JS

              
                ReactModal.setAppElement('#main');

class ExampleApp extends React.Component {
  constructor () {
    super();
    this.state = {
      showModal: false
    };
    
    this.handleOpenModal = this.handleOpenModal.bind(this);
    this.handleCloseModal = this.handleCloseModal.bind(this);
  }
  
  handleOpenModal () {
    this.setState({ showModal: true });
  }
  
  handleCloseModal () {
    this.setState({ showModal: false });
  }
  
  render () {
    return (
      <div className={this.state.showModal ? "wrapper overlay" : "wrapper"}>
        <header>
          <h1>Keyboard Unfriendly Modal</h1>
          <nav>
            <a href="#">Page 1</a>
            <a href="#">Page 2</a>
          </nav>
        </header>
        <button onClick={this.handleOpenModal}>Trigger Modal</button>
        <main>
          <p>Cupcake ipsum dolor sit amet cheesecake sweet. Danish topping candy donut oat cake liquorice marzipan. Tart sweet roll cheesecake chocolate. Lollipop gummies cake caramels muffin powder soufflé jujubes. Tootsie roll oat cake danish. Dessert croissant brownie oat cake chocolate cake wafer sweet roll. Oat cake jujubes halvah chupa chups carrot cake apple pie. Ice cream halvah candy gummies bonbon tiramisu dragée. Oat cake macaroon carrot cake tootsie roll pudding cotton candy <a href="https://codepen.io/ijayessbe/pen/pojGxWx">gingerbread</a>. Chupa chups chocolate cake brownie dragée jujubes topping. Gummi bears lollipop candy cupcake apple pie bonbon. Bear claw sweet dessert.</p>
        </main>
        {this.state.showModal && (<div className="modal open">
          <header>
            <h1>Modal Content</h1>
            <button onClick={this.handleCloseModal}>Close Modal</button>
          </header>
          <p>Ice cream muffin pastry candy canes biscuit toffee ice cream. Dessert soufflé dessert carrot cake cupcake topping topping. Caramels chocolate bar bear claw croissant marzipan marzipan.</p>
        </div>)}
      </div>
    );
  }
}

const props = {};

ReactDOM.render(<ExampleApp {...props} />, document.getElementById('main'))
              
            
!
999px

Console