Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              $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
            
          
!
            
              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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console