Ecommerce cart / wishlist design using Html CSS and Bootstrap 5
Ecommerce website cart / wishlist design using Html CSS and Bootstrap 5
In this post, you will be learning how to make customized cart or wishlist design for e-commerce using HTML, CSS, and Bootstrap 5.
View:
Step 1: Write basic HTML 5 template in index.html and link style.css file to the index.html file.
index.html Page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ecommerce Cart/Wishlist Page Design</title>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="py-3 py-md-5 bg-light">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="shopping-cart">
<div class="cart-header d-none d-sm-none d-mb-block d-lg-block">
<div class="row">
<div class="col-md-6">
<h4>Products</h4>
</div>
<div class="col-md-2">
<h4>Price</h4>
</div>
<div class="col-md-2">
<h4>Quantity</h4>
</div>
<div class="col-md-2">
<h4>Remove</h4>
</div>
</div>
</div>
<div class="cart-item">
<div class="row">
<div class="col-md-6 my-auto">
<a href="">
<label class="product-name">
<img src="hp-laptop.jpg" style="width: 50px; height: 50px" alt="">
Hp Laptop
</label>
</a>
</div>
<div class="col-md-2 my-auto">
<label class="price">$569 </label>
</div>
<div class="col-md-2 col-7 my-auto">
<div class="quantity">
<div class="input-group">
<span class="btn btn1"><i class="fa fa-minus"></i></span>
<input type="text" value="1" class="input-quantity" />
<span class="btn btn1"><i class="fa fa-plus"></i></span>
</div>
</div>
</div>
<div class="col-md-2 col-5 my-auto">
<div class="remove">
<a href="" class="btn btn-danger btn-sm">
<i class="fa fa-trash"></i> Remove
</a>
</div>
</div>
</div>
</div>
<div class="cart-item">
<div class="row">
<div class="col-md-6 my-auto">
<a href="">
<label class="product-name">
<img src="hp-laptop.jpg" style="width: 50px; height: 50px" alt="">
Hp Laptop
</label>
</a>
</div>
<div class="col-md-2 my-auto">
<label class="price">$569 </label>
</div>
<div class="col-md-2 col-7 my-auto">
<div class="quantity">
<div class="input-group">
<span class="btn btn1"><i class="fa fa-minus"></i></span>
<input type="text" value="1" class="input-quantity" />
<span class="btn btn1"><i class="fa fa-plus"></i></span>
</div>
</div>
</div>
<div class="col-md-2 col-5 my-auto">
<div class="remove">
<a href="" class="btn btn-danger btn-sm">
<i class="fa fa-trash"></i> Remove
</a>
</div>
</div>
</div>
</div>
<div class="cart-item">
<div class="row">
<div class="col-md-6 my-auto">
<a href="">
<label class="product-name">
<img src="hp-laptop.jpg" style="width: 50px; height: 50px" alt="">
Hp Laptop
</label>
</a>
</div>
<div class="col-md-2 my-auto">
<label class="price">$569 </label>
</div>
<div class="col-md-2 col-7 my-auto">
<div class="quantity">
<div class="input-group">
<span class="btn btn1"><i class="fa fa-minus"></i></span>
<input type="text" value="1" class="input-quantity" />
<span class="btn btn1"><i class="fa fa-plus"></i></span>
</div>
</div>
</div>
<div class="col-md-2 col-5 my-auto">
<div class="remove">
<a href="" class="btn btn-danger btn-sm">
<i class="fa fa-trash"></i> Remove
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Step 2: Create style.css file and link to the above index.html file and paste the below CSS code in style.css:
/* Cart or Wishlist */
.shopping-cart .cart-header{
padding: 10px;
}
.shopping-cart .cart-header h4{
font-size: 18px;
margin-bottom: 0px;
}
.shopping-cart .cart-item a{
text-decoration: none;
}
.shopping-cart .cart-item{
background-color: #fff;
box-shadow: 0 0.125rem 0.25rem rgb(0 0 0 / 8%);
padding: 10px 10px;
margin-top: 10px;
}
.shopping-cart .cart-item .product-name{
font-size: 16px;
font-weight: 600;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
cursor: pointer;
}
.shopping-cart .cart-item .price{
font-size: 16px;
font-weight: 600;
padding: 4px 2px;
}
.shopping-cart .btn1{
border: 1px solid;
margin-right: 3px;
border-radius: 0px;
font-size: 10px;
}
.shopping-cart .btn1:hover{
background-color: #2874f0;
color: #fff;
}
.shopping-cart .input-quantity{
border: 1px solid #000;
margin-right: 3px;
font-size: 12px;
width: 40%;
outline: none;
text-align: center;
}
/* Cart or Wishlist */
Thanks for reading.