DEV Community 👩‍💻👨‍💻

Cover image for How to create a gradient drop shadow
Stackfindover
Stackfindover

Posted on • Updated on

How to create a gradient drop shadow

Hello, guys In this tutorial we will try to solve the mentioned query. and also we will learn how to create a gradient drop shadow

Common Query

  1. How to create a gradient drop shadow
  2. How to an awesome drop shadow
  3. How to create a drop shadow

See Also :- How to create a animated button

How to create gradient drop shadow step by step

First, we need to create two files index.html and style.css then we need to do code for it.

Step:#1

Add below code inside index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>How to create gradient shadow css</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="style.css" />
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
  </head>
  <body>
    <div class="box">
      <h1>Stackfindover</h1>
    </div>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

Step:#2

Then we need to add code for style.css which code I provide in the below screen.

* {
  padding: 0;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  background-color: #f2f4f6;
}
.box {
  position: relative;
  width: 320px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to top left, #0400ff, #ff3d00);
  border-radius: 10px;
}
h1 {
  color: #fff;
}
.box:before {
  content: "";
  z-index: -1;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: inherit;
  transform: translateY(20px) scale(0.95);
  filter: blur(20px);
  opacity: 0.7;
  transition: opacity 0.3s;
}
.box:hover:before {
  opacity: 1;
}
Enter fullscreen mode Exit fullscreen mode

How to create gradient drop shadow video output:

How to create gradient drop shadow Codepen Output:

Top comments (0)

Head to your account's Settings to...

🌚 Enable dark mode
🔠 Change your default font
📚 Adjust your experience level to see more relevant content