Pen Settings



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


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


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.


Auto Save

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.



<p class="counter"></p>



                body {
  text-align: center;
  background: #eee;
  padding: 20px;

.counter {
  font-size: 2em;
  background: #fff;
  display: inline-block;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #ccc;


const reiwa = document.querySelector('.reiwa');
const counter = document.querySelector('.counter');

function nanNichi(){

const d1 = new Date();
const d2 = new Date('2019/05/01 00:00'); //令和元年
const d3 = d2 - d1;
// ミリ秒から秒に
const d3_Sec = Math.floor(d3 / 1000);

const Minute_Sec = 60;
const Hour_Sec = 60 * 60;
const Day_Sec = 60 * 60 * 24;

const d4_Day = Math.floor(d3_Sec / Day_Sec);

const d5_Hour = Math.floor(d3_Sec / Hour_Sec  % 24);

const d6_Minute = Math.floor(d3_Sec / Minute_Sec % 60);

const d7_Sec = Math.floor(d3_Sec % 60);
counter.innerHTML = d4_Day + "日" + d5_Hour + "時間" + d6_Minute + "分" + d7_Sec + "秒!!";

setTimeout(nanNichi, 1000);