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

              
                <!DOCTYPE html>
<html>
<head>
    <title>eCommerce Product Page</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <div class="header-content">
            <h1>Our Online Store</h1>
            <nav>
                <ul>
                    <li><a href="#home">Home</a></li>
                    <li><a href="#new-arrivals">New Arrivals</a></li>
                    <li><a href="#best-sellers">Best Sellers</a></li>
                    <li><a href="#sale">Sale</a></li>
                </ul>
                <div class="cart-icon">
                </div>
            </nav>
        </div>
    </header>

    <main class="product-container">
        <!-- Products-->
        <section class="product" id="product1">
            <img src="https://i.imgur.com/LXwNDDd.jpg" width="100%" alt="Product 1">
            <h2>Product 1</h2>
            <p class="price">$19.99</p>
            <button class="add-to-cart">Add to Cart</button>
        </section>
        <section class="product" id="product1">
            <img src="https://i.imgur.com/LXwNDDd.jpg" width="100%" alt="Product 1">
            <h2>Product 2</h2>
            <p class="price">$21.99</p>
            <button class="add-to-cart">Add to Cart</button>
        </section>
      <section class="product" id="product1">
            <img src="https://i.imgur.com/LXwNDDd.jpg" width="100%" alt="Product 1">
            <h2>Product 3</h2>
            <p class="price">$24.99</p>
            <button class="add-to-cart">Add to Cart</button>
        </section>
      <section class="product" id="product1">
            <img src="https://i.imgur.com/LXwNDDd.jpg" width="100%" alt="Product 1">
            <h2>Product 4</h2>
            <p class="price">$9.99</p>
            <button class="add-to-cart">Add to Cart</button>
        </section>
        <!-- Additional eCommerce sections if needed -->
    </main>

    <footer>
        <p>© 2023 Our Online Store. All rights reserved.</p>
    </footer>
</body>
</html>

              
            
!

CSS

              
                body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f8fb;
}

header {
    background-color: #333;
    color: white;
    padding: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Add padding for spacing */
}

.header-content h1 {
    margin: 0;
    flex-grow: 1; /* Ensures the title takes the available space */
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0 15px; /* Adjusted spacing between menu items */
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #a8dadc; /* Hover effect color change */
}

.cart-icon {
    display: flex;
    align-items: center;
}

.cart-icon img {
    width: 30px;
    height: auto;
}


.product-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
}

.product {
    background-color: white;
    margin: 10px;
    padding: 20px;
    width: calc((100% / 3) - 40px); /* Adjust for 3 products per row */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.product img {
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
}

.product h2 {
    color: #333;
    margin-bottom: 10px;
}

.price {
    color: #007bff;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.add-to-cart {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.add-to-cart:hover {
    background-color: #218838;
}

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px 0;
}

@media screen and (max-width: 768px) {
    .product {
        width: calc((100% / 2) - 30px); /* Adjust for 2 products per row */
    }
}

@media screen and (max-width: 480px) {
    .product {
        width: 100%; /* Full width for single product per row */
    }
}


              
            
!

JS

              
                
              
            
!
999px

Console