Open In App

How to Create a Transparent or Blurred Card using CSS?

Last Updated : 18 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Making a transparent or blurred card with CSS can give your website a modern look. This effect allows your content to shine while still showing some of the background. By using properties like backdrop-filter and light colors, you can create a card that looks great and adds style to your page.

Approach to Create a Transparent or Blurred Card using CSS

  • Create a background area using div a green color. This will serve as the base for your card.
  • Inside the background div, add another div for the card itself. This card will have a width, height, and rounded corners.
  • Use CSS to add styles to the card, such as a shadow for depth, a blur effect for the background, and a semi-transparent white background color. This makes the card stand out against the background.
  • Inside the card, include text elements like a heading and a subheading to convey your message. Style them to fit well within the card.

Example: We will create a glass or blurred or transparent card using the above approach. As mentioned in the first step, we will create the layout of the card under the body tag.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Blur Card</title>
    <style>
        .background {
            background-color: green;
            height: 150px;
            padding: 10px;
        }

        .card {
            margin-right: auto;
            margin-left: auto;
            width: 250px;
            box-shadow: 0 15px 25px rgba(129, 124, 124, 0.2);
            height: 300px;
            border-radius: 5px;
            backdrop-filter: blur(14px);
            background-color: rgba(255, 255, 255, 0.2);
            padding: 10px;
            text-align: center;
        }

        .card img {
            height: 60%;
        }
    </style>
</head>

<body>
    <div class="background">
        <div class="card">
        
            <h1>CODE WORLD</h1>
            <h3>Happy Coding</h3>
        </div>
    </div>
</body>

</html>

Output: 

Output

Output




Similar Reads