Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <h1>Dialog Element</h1>

<button class="open-modeless open-button">show()</button>
<button class="open-modal open-button">showModal()</button>

<!-- モードレスダイアログ -->
<dialog class="modeless">
  <!-- ダイアログヘッダー -->
  <div class="dialog-header">
    <p>Modeless Dialog</p>
    <button class="close-modeless close-button">&times;</button>
  </div>
  <!-- ダイアログコンテンツ -->
  <h2 class="title">Welcome to Pyxofy</h2>
  <p class="message">Empower Digital Natives thru Education and Technology</p>
</dialog>

<!-- モーダルダイアログ -->
<dialog class="modal">
  <!-- ダイアログヘッダー -->
  <div class="dialog-header">
    <p>Modal Dialog</p>
    <button class="close-modal close-button">&times;</button>
  </div>
  <!-- ダイアログコンテンツ -->
  <h2 class="title">Welcome to Pyxofy</h2>
  <p class="message">Empower Digital Natives thru Education and Technology</p>
</dialog>
              
            
!

CSS

              
                body {
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
}

/* ダイアログを開くボタン */
.open-button {
  margin: 10px;
  width: 200px;
  height: 50px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background-color: #fcc891;
  cursor: pointer;
}

.open-button:hover {
  color: #ffffff;
  background-color: #ed7e07;
  box-shadow: 0 5px 5px #cccccc;
}

/* ダイアログ */
.modeless,
.modal {
  width: 70%;
  max-width: 500px;
  padding: 0;
  border: none;
  box-shadow: #595959 2px 2px 5px 2px;
}

/* モーダルダイアログの背後 */
.modal::backdrop {
  background-color: #12121290;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px); /* Safari */
}

/* ダイアログヘッダー */
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  padding: 0 10px 0 10px;
  margin-bottom: 30px;
  color: #ffffff;
  background-color: #0d7df5;
}

.dialog-header p {
  font-size: 15px;
}

/* ダイアログを閉じるボタン */
.close-button {
  width: 40px;
  height: 40px;
  font-size: 15px;
  font-weight: bold;
  margin-left: auto;
  background-color: #e6e6e6;
  cursor: pointer;
  border: none;
  border-radius: 20px;
}

.close-button:hover {
  color: #ffffff;
  font-weight: bold;
  background-color: #ed7e07;
}

.title {
  font-size: 30pxe;
  margin: 20px;
}

.message {
  font-size: 18px;
  margin: 30px 20px;
}

              
            
!

JS

              
                //ダイアログを開くボタン
const openModeless = document.querySelector(".open-modeless");
const openModal = document.querySelector(".open-modal");
//ダイアログ
const modeless = document.querySelector(".modeless");
const modal = document.querySelector(".modal");
//閉じるボタン
const closeModeless = document.querySelector("button.close-modeless");
const closeModal = document.querySelector("button.close-modal");

//モードレスダイアログを開く
openModeless.addEventListener("click", () => {
  modeless.show();
});
//モーダルダイアログを開く
openModal.addEventListener("click", () => {
  modal.showModal();
});

//モードレスダイアログを閉じる
closeModeless.addEventListener("click", () => {
  modeless.close();
});
//モーダルダイアログを閉じる
closeModal.addEventListener("click", () => {
  modal.close();
});

              
            
!
999px

Console