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

              
                <html lang="pt-BR">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>E-commerce Geek</title>
</head>

<body>
  <div class="app">
    <div class="sidebar">
      <h2>Loja Geek</h2>
      <ul>
        <li>Início</li>
        <li>Produtos</li>
        <li>Contato</li>
      </ul>
    </div>
    <div class="content">
      <div class="search-bar">
        <input type="text" placeholder="Buscar produtos..." />
        <button type="button">Pesquisar</button>
      </div>

      <div class="cards">
        <div class="card">
          <img src="https://i.pinimg.com/736x/94/4c/ce/944cceec5441301d7ef71bacbbd6b055.jpg" alt="Produto 1" />
          <h3>Camiseta Star Wars</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 59,90</span>
        </div>
        <div class="card">
          <img src="https://i.pinimg.com/736x/12/94/90/129490626e302c8b80928b7d768a25f5.jpg" alt="Produto 2" />
          <h3>Action Figure Thanos</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 199,90</span>
        </div>
        <div class="card">
          <img src="https://i.pinimg.com/564x/58/a5/06/58a506e6c761ba31bc69c0d5904d329d.jpg" alt="Produto 3" />
          <h3>Caneca Senhor dos Anéis</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 39,90</span>
        </div>
        <div class="card">
          <img src="https://i.pinimg.com/564x/a1/df/2c/a1df2ca3406a0ab8be69b1e2c2467c5e.jpg" alt="Produto 4" />
          <h3>Poster Vingadores</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 29,90</span>
        </div>
        <div class="card">
          <img src="https://i.pinimg.com/564x/b3/e8/47/b3e84763179a2d9fe8957eeaed5fb5ed.jpg" alt="Produto 5" />
          <h3>Camiseta Geek</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 49,90</span>
        </div>
        <div class="card">
          <img src="	https://i.pinimg.com/564x/f6/e4/65/f6e46510b63159fb13c12450cdfe7bb9.jpg" alt="Produto 6" />
          <h3>Fone de Ouvido Gamer</h3>
          <p>Descrição curta do produto.</p>
          <span>R$ 299,90</span>
        </div>
      </div>
    </div>
  </div>
</body>

</html>
              
            
!

CSS

              
                /* Estilos gerais */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #02121E;
  color: #000;
}

.app {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 20px;
  padding: 20px;
  height: 100vh;
}

.sidebar {
  background-color: #333;
  color: white;
  padding: 20px;
  border-radius: 10px;
}

.sidebar h2 {
  margin-top: 0;
  font-size: 24px;
  font-weight: bold;
}

.sidebar ul {
  list-style-type: none;
  padding: 0;
}

.sidebar ul li {
  margin: 15px 0;
  cursor: pointer;
}

.content {
  padding: 20px;
  background-color: #f4f4f4;
  border-radius: 10px;
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 16px;
}

.search-bar button {
  padding: 10px 20px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-bar button:hover {
  background-color: #555;
}

.search-bar input::placeholder {
  font-size: 16px;
}

.cards {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.card img {
  max-width: 100%;
  border-radius: 10px;
}

.card h3 {
  margin: 10px 0;
  font-size: 18px;
  font-weight: bold;
}

.card p {
  margin: 10px 0;
  font-size: 0.9rem;
  color: #555;
}

.card span {
  font-weight: bold;
  color: #333;
}

/* Estilos responsivos usando container queries */

.content {
  container-type: inline-size;
}

.app {
  container-type: inline-size;
  container-name: menu-lateral;
}

@container (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(2, 1fr); /* Reduz para 2 colunas */
  }
}

@container (max-width: 600px) {
  .cards {
    grid-template-columns: 1fr; /* Apenas 1 coluna */
  }
}

@container menu-lateral (max-width: 600px){
  .sidebar {
    text-align: center;
  }
  
  .sidebar h2 {
    font-size: 6cqw;  /* 6% da largura do container */
  }
  
  .sidebar ul {
    display: none;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console