htmlcssresponsive-designblurcard

How to achieve this given css glass effect with color that is leaking?


enter image description here

I want to recreate this glassy card, but I don't know how to achieve this I can get the glassy effect but can't achieve this blur color effect and I used backdrop filter property of CSS but it's not working


Solution

  • Use background: radial-gradient() + backdrop-filter: blur():

    body {
      background-color: black;
      color: white;
    }
    
    .card {
      position: relative;
      border-radius: 20px;
      width: 120px;
      padding: 20px;
      min-height: 200px;
    }
    
    .card > * {
      position: relative;
      z-index: 1;
    }
    
    .card:before,
    .card:after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
    }
    
    .card:before {
      background:  radial-gradient(circle at 50% 20%, rgba(255, 0, 0, .6), rgba(255, 0, 0, 0));
    }
    
    .card:after {
      background-color: black;
      opacity: .4;
      backdrop-filter: blur(20px);
      border: solid 1px rgba(255,255,255,.4);
    }
    <div class="card">
      <div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam, ullam?</div>
    </div>