cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-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.

            
              <html>
  <head>
    <script src="//cdnjs.cloudflare.com/ajax/libs/react/0.11.2/JSXTransformer.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/react/0.11.2/react.min.js"></script>
  </head>
  <body>
    <!-- The jsx script type is required for JSX to run, so the javascript must be embedded here to work on codepen. -->
    <script type="text/jsx">
      /** @jsx React.DOM */

      var InputDemo = React.createClass({
        getInitialState: function() {
          return {
            hasContent: false,
            content: ''
          }
        },

        changeHandler: function(e) {
          this.setState({content: e.target.value});
          this.setState({hasContent: this.state.content !== ''});
        },

        render: function() {
          return <div className={this.state.hasContent ? 'active input-wrap' : 'inactive input-wrap'}>
            <input className="input" type="text" onChange={this.changeHandler} />
            <ContentArea content={this.state.content} />
          </div>;
        }
      });

      var ContentArea = React.createClass({
        render: function() {
          return <div className="output">
            <p>{this.props.content}</p>
          </div>;
        }
      });

      React.renderComponent(<InputDemo className="demo" />, document.body);
    </script>
  </body>
</html>
            
          
!
            
              html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background-color: #f7f7f7;
}
.input-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -128px;
  margin-top: -84px;
}
.input {
  color: #555;
  box-sizing: border-box;
  padding: 20px;
  width: 256px;
  font-size: 18px;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  border: 1px solid #ebebeb;
  transition: border 400ms ease;
  outline: 0;
}
.input:focus {
  border: 1px solid #666;
}
.output {
  box-sizing: border-box;
  padding: 20px;
  width: 256px;
  font-size: 18px;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
            
          
!
999px
Loading ..................

Console