Open In App

Create an Online Art Auction using HTML, CSS and JavaScript

In this article, we’ll guide you through the process of creating an online art auction website using HTML, CSS, and JavaScript. Art auctions are exciting events where collectors and enthusiasts bid on prized artworks. It will provide a foundation for displaying art listings and creating an appealing user interface.

Preview of final output: Let us have a look at how the final output will look like.



Prerequisites:



Step-Wise Approach to create Online Art Auction:

Example: Below is the basic implementaion to create an Online Art Auction using HTML & CSS




function placeBid() {
  alert("Successfully Bid!");
}
const Buttons =
  document.querySelectorAll(".art-card button");
Buttons.forEach(button => {
  button.addEventListener("click", placeBid);
});




<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,
                   initial-scale=1.0">
    <title>The Online Art Auction</title>
    <link rel="stylesheet" href="style.css">
</head>
 
<body>
    <header>
        <h1>
            Welcome to Online
            Art Auction
        </h1>
    </header>
    <section class="art-listings">
        <div class="art-card">
            <!-- add your image url here -->
            <img src="a.jpg" alt="Artwork 1">
            <h2>Artwork - 01</h2>
            <p>Artist: Kumar </p>
            <p>
                Description: Description of
                the artwork goes here.
            </p>
            <p>Current Bid: $500</p>
            <button>Place Bid</button>
        </div>
        <div class="art-card">
            <!-- add your image url here -->
            <img src="b.jpg" alt="Artwork 2">
            <h2>Artwork - 02</h2>
            <p>Artist: Raj 2</p>
            <p>
                Description: Description of
                the artwork goes here.
            </p>
            <p>Current Bid: $700</p>
            <button>Place Bid</button>
        </div>
    </section>
    <script src="script.js"></script>
</body>
 
</html>




* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
body {
    font-family: Arial, sans-serif;
    background-color: #669966;
    margin: 0;
    padding: 0;
}
 
header {
    background-color: #0000ff;
    color: #fff;
    text-align: center;
    padding: 20px 0;
}
 
h1 {
    font-size: 36px;
    margin: 0;
}
 
.art-listings {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}
 
.art-card {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    max-width: 300px;
}
 
.art-card:hover {
    transform: translateY(-5px);
}
 
img {
    max-width: 100%;
    height: auto;
}
 
h2 {
    font-size: 24px;
    margin: 10px 0;
}
 
p {
    font-size: 16px;
    margin: 8px 0;
}
 
button {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
}
 
footer {
    text-align: center;
    background-color: #333;
    color: #fff;
    padding: 10px 0;
}

Output:


Article Tags :