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

              
                <body>
  
  <script>
  /*
    为抵抗洪水,战士连续作战89小时,编程计算共多少天零多少小时?
    */
  var hours = 86 % 24;
  var day = parseInt(86 / 24);
  console.log("共需要" + day + "天零" + hours + "小时");

  /*小明要到美国旅游,可是那里的温度是以华氏度为单位记录的。它需要一个程序将华氏温度(80度)转换为摄氏度,并以华氏度和摄氏度为单位分别显示该温度。
提示:摄氏度与华氏度的转换公式为:摄氏度 = 5/9.0*(华氏度-32) */
  var tip = (5 / 9.0) * (80 - 32);
  console.log("华氏温度80读度等于" + tip + "摄氏度");

  /*给定一个数,把它保留3位小数*/
  var num = 5.36589;
  console.log(parseInt(num * 1000) / 1000);

  var k = 0;
  console.log(k++ + ++k + k + k++); //结果是?为什么?//++y(先自加再运算)和y++(先运算再自加)
  console.log(k)
  //     k++   ++k   k  k++
  //k    1     2     2  3
  //num  0     2     4  6
</script>
</body>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console