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 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="app"></div>

              
            
!

CSS

              
                $color_white: #fbfbfc
$color_blue_light: #96ceed
$color_blue_dark: #4472C4
$color_orange: #ed7057

#robot
   margin-left: -200px
   margin-top: 130px
   
html
   display: flex
   justify-content: center
   // background: linear-gradient(to right, #7f00ff, #e100ff)
   background-color: $color_blue_dark
   
#hello-world
   margin-top: 200px
   padding: 36px
   display: flex
   align-items: center
   flex-direction: column
   width: 310px
   height: 170px
   border-radius: 20px
   cursor: pointer
   // background: linear-gradient(to top, #e100ff, #7f00ff, #7f00ff)
   background-color: $color_orange
   color: white
   font-family: 'Lato', sans-serif
   z-index: 1
   box-shadow: 5px 5px 15px #000

h2
   margin-bottom: -20px
   font-size: 20px
   
   
input
   margin-top: 30px
   margin-left: 5px
   height: 30px
   width: 200px
   border-radius: 3px
   border: 1px solid #fff
   padding: 5px
   
input:focus
   outline: #f24

   
#circle1
   width: 80px
   height: 80px
   border-radius: 50%
   background-color: #D51E05
   margin-left: -25px
   
#circle2
   width: 80px
   height: 80px
   border-radius: 50%
   background-color: #EEAB05
   margin-top: -80px
   margin-left: 25px

#idcard
   width: 60px
   height: 80px
   margin-top: 20px
   border-radius: 5px
   margin-left: -230px
   background-color: #000

#card_num
   margin-left: 40px
   width: 400px
   overflow: hidden
   
#user_name
   margin-left: -230px
   margin-top: -30px
#mastercard_words
   font-size: 15px
              
            
!

JS

              
                class MasterCard extends React.Component{
   
   constructor(props){
      super(props);
      
      this.state = {
         card_num: "2893-0232-3093-2112"
         
      }
   }
   
   togglecard_num(){
      if(this.state.card_num === "hotpink"){
         this.setState({
            card_num: "2893-0232-3093-2112"
         });
      }else{
         this.setState({
            card_num: "2893-0232-3093-2112"
         });
      }
      
   }
   
   changecard_num(event){
      this.setState({
         card_num: event.target.value
      });
   }
   
   render(){
      const styleObj = {
         // backgroundColor: this.state.color,
         fontSize: 32 / 2
         
      };
      return(
         <section>
            <div class="card" style={styleObj} id="hello-world">
               <div id="circle">
                  <div id="circle1"></div>
                  <div id="circle2"></div>
                  <span id="mastercard_words">MasterCard</span>
               </div>
               <div id="idcard">
               </div>
               <span id="user_name">Ya-Yun Tsai</span>
            <h2 onClick={this.togglecard_num.bind(this)}> {this.state.card_num} </h2>
               </div>
            <span id="card_num">Card Number</span><input value={this.state.card_num} onChange={this.changecard_num.bind(this)}/>
            
         </section>
         
         
      );
   }
}

ReactDOM.render(<MasterCard name="Annie"/>, document.getElementById("app"));

// var Helloworld = React.createClass({
//    render: function(){
//       return(
//          <h2>Hello world! </h2>
//       );
//    }
// })
              
            
!
999px

Console