How to create a "coupon" with CSS?

CSSWeb DevelopmentFront End Technology

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


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
   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;
<div class="couponContainer">
<div class="detailContainer">
<h3>Food Inc ©</h3>
<img src=""/>
<div class="detailContainer" style="background-color:white">
<h2>Worlds Best Pancakes</h2>
<div class="detailContainer">
Use code <span class="promo">Free24</span> to get 24% off on your next
<p class="expiryDate">Expires in 20 days</p>


The following output will be produced by the above code −

Updated on 07-May-2020 12:31:01