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>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
  <button class="btn open">Abrir modal</button>

<!-- MODAL -->
<dialog class="modal" aria-labelledby="dialog-title">
  <h2 id="dialog-title">Header da Modal</h2>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
   <form method="dialog">
    <label for="name">Nome:</label>
    <input type="text" id="name" placeholder="Digite seu nome" required />
    <button type="submit">Enviar</button>
  <button type="button" class="btn close" aria-label="Fechar modal">X</button>


                @import url(";500&display=swap");

.modal {
  background: #fafafa;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  width: min(37rem, 80%);

.modal::backdrop {
  background: rgba(0, 0, 0, .7);

.modal h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #0d114f;

.modal p {
  margin-bottom: 1.5rem;
  color: #4d5e77;

.modal button {
  cursor: pointer;

/* Estilos extras */

body {
  background: #fafafa;
  height: 90vh;
  padding: 0 1rem;

button {
  font-family: "Poppins", sans-serif;

.btn {
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 1rem;
  background: #3485ff;
  color: #fafafa;
  transition: filter 0.2s;
  padding: 1rem 2rem;
  cursor: pointer;

.btn.close {
  display: flex;
  align-items: center;
  clip-path: circle();
  position: absolute;
  top: 2rem;  
  right: 2rem;
  height: 1rem;
  aspect-ratio: 1/1;

.btn:hover, .btn:focus, button:hover, button:focus {
  filter: brightness(1.2);


                const modal = document.querySelector(".modal");
const openModalBtn = document.querySelector(".open");
const closeModalBtn = document.querySelector(".close");

openModalBtn.addEventListener("click", () => modal.showModal());

closeModalBtn.addEventListener("click", () => modal.close());