How to create a "coupon" with CSS?

CSSWeb DevelopmentFront End Technology

To create a coupon with CSS, the code is as follows −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   img {
      width: 100%;
   }
   .couponContainer {
      border: 5px dashed #bbb;
      width: 80%;
      border-radius: 15px;
      margin: 0 auto;
      max-width: 600px;
   }
   .detailContainer {
      padding: 2px 16px;
      background-color: #d4d4d4;
   }
   .promo {
      background: rgb(104, 104, 104);
      color: white;
      padding: 10px;
   }
   .expiryDate {
      color: red;
      font-weight: bold;
   }
</style>
</head>
<body>
<div class="couponContainer">
<div class="detailContainer">
<h3>Food Inc ©</h3>
</div>
<img src="https://images.pexels.com/photos/376464/pexels-photo376464.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"/>
<div class="detailContainer" style="background-color:white">
<h2>Worlds Best Pancakes</h2>
</div>
<div class="detailContainer">
<p>
Use code <span class="promo">Free24</span> to get 24% off on your next
dish
</p>
<p class="expiryDate">Expires in 20 days</p>
</div>
</div>
</body>
</html>

Output

The following output will be produced by the above code −

raja
Published on 07-May-2020 12:29:57
Advertisements