Box-Shadow and Filter: Drop-Shadow Effect in CSS | FreeProjects1

BHOLU SINGH
0

Creating Stunning Visuals with CSS Box-Shadow and Filter: Drop-Shadow Effect

Box-Shadow is a CSS property that allows you to add a shadow to an element. It can be used to create various visual effects, such as depth, lighting, or perspective.

Filter: Drop-Shadow is a CSS filter that adds a drop shadow effect to an element. It can be used to give the element a 3D look or add depth and perspective.

If you want to get free source code then scroll down the post.

Image loading error | FreeProjects1


What is Box-Shadow and Filter: Drop-Shadow Effect in CSS

Box-shadow is a CSS property that adds a shadow to an element. It takes values for the x and y offsets of the shadow, the blur radius, the spread radius, and the color of the shadow.

Filter: drop-shadow is a CSS filter function that adds a drop shadow to an element. It takes values for the x and y offsets of the shadow, the blur radius, the spread radius, and the color of the shadow.



Understanding the box-shadow and filter: drop-shadow Effects in CSS

The box-shadow and filter: drop-shadow effects in CSS are used to create a shadow around an element. The box-shadow effect is applied to the element's box, while the filter: drop-shadow effect is applied to the element's content. Both effects can be used to create a shadow that appears to be behind the element.

The box-shadow effect can be used to create a shadow with a variety of properties, including color, blur, spread, and offset. The color of the shadow can be set using the color property, and the blur and spread properties can be used to control the size and intensity of the shadow. The offset property can be used to control the position of the shadow.

The filter: drop-shadow effect can be used to create a shadow with a variety of properties, including color, blur, and offset. The color of the shadow can be set using the color property, and the blur property can be used to control the size and intensity of the shadow. The offset property can be used to control the position of the shadow.

Both the box-shadow and filter: drop-shadow effects can be used to create a realistic shadow effect on an element. They can be used to create a subtle shadow effect or a more dramatic one, depending on the properties used.



A Comprehensive Guide to Using the Drop-shadow Effect in CSS

The drop-shadow effect is a popular way to add depth and dimension to elements on a web page. It can be used to create subtle shadows or more dramatic effects, depending on the values you set. In this guide, we’ll cover how to use the drop-shadow effect in CSS.

1. Define the Shadow: The first step is to define the shadow. You can do this by using the box-shadow property. This property takes four values: the horizontal offset, the vertical offset, the blur radius, and the color.

The horizontal offset is the amount of space the shadow will be offset from the left or right side of the element. The vertical offset is the amount of space the shadow will be offset from the top or bottom of the element. The blur radius is the amount of blur that will be applied to the shadow. And the color is the color of the shadow.

2. Set the Position: The next step is to set the position of the shadow. You can do this by using the position property. This property takes two values: the horizontal position and the vertical position. The horizontal position is the amount of space the shadow will be offset from the left or right side of the element. The vertical position is the amount of space the shadow will be offset from the top or bottom of the element.

3. Adjust the Blur: The blur radius is the amount of blur that will be applied to the shadow. You can adjust the blur radius by using the blur property. This property takes a single value, which is the amount of blur that will be applied to the shadow.

4. Set the Color: The last step is to set the color of the shadow. You can do this by using the color property. This property takes a single value, which is the color of the shadow.

Using the drop-shadow effect in CSS is a great way to add depth and dimension to elements on a web page. By following the steps outlined in this guide, you can create subtle shadows or more dramatic effects, depending on the values you set.



A Comprehensive Guide to Using the Box-shadow Effect in CSS

The box-shadow effect is one of the most popular and versatile effects in CSS. It can be used to create a variety of different effects, from subtle shadows to more complex 3D effects. In this guide, we’ll take a look at how to use the box-shadow effect in CSS.

1. Basic Syntax: The basic syntax for the box-shadow effect is as follows:

box-shadow: <offset-x> <offset-y> <blur-radius> <spread-radius> <color>;

The offset-x and offset-y values determine the position of the shadow relative to the element. The blur-radius and spread-radius values determine the size and shape of the shadow. The color value determines the color of the shadow.

2. Multiple Shadows: You can create multiple shadows by separating each shadow definition with a comma. For example:

box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.5), -10px -10px 5px 0px rgba(0, 0, 0, 0.5);

This will create two shadows, one offset 10px to the right and 10px down, and the other offset -10px to the left and -10px up.

3. Inset Shadows: Inset shadows are shadows that appear inside the element. To create an inset shadow, add the keyword “inset” before the shadow definition. For example:

box-shadow: inset 10px 10px 5px 0px rgba(0, 0, 0, 0.5);

This will create an inset shadow offset 10px to the right and 10px down.

4. Spread Radius: The spread-radius value determines the size of the shadow. A positive value will make the shadow larger, while a negative value will make it smaller.

5. Blur Radius: The blur-radius value determines the blurriness of the shadow. A higher value will make the shadow more blurry, while a lower value will make it sharper.

6. Color: The color value determines the color of the shadow. You can use any valid CSS color value, such as hex codes, RGB values, or color names.

7. Box-shadow Shorthand: You can use the box-shadow shorthand property to set multiple shadows in one line of code. The syntax is as follows:

box-shadow: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> <offset-x> <offset-y> <blur-radius> <spread-radius> <color>;

For example:

box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.5), -10px -10px 5px 0px rgba(0, 0, 0, 0.5);

This will create two shadows, one offset 10px to the right and 10px down, and the other offset -10px to the left and -10px up.

Conclusion: The box-shadow effect is a powerful and versatile effect in CSS. It can be used to create a variety of different effects, from subtle shadows to more complex 3D effects. In this guide, we’ve looked at how to use the box-shadow effect in CSS. We’ve also looked at the basic syntax, multiple shadows, inset shadows, spread radius, blur radius, color, and box-shadow shorthand.



Here is an example of how you could create a box-shadow and drop-shadow:

Here is an example of HTML for box-shadow and drop-shadow effect:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> CSS Box-Shadow Vs Filter:Drop-Shadow Effect | FreeProjects1 </title>
    <meta name="keywords" content="box shadow vs drop shadow, freeprojects1.blogspot.com">
    <meta name="description" content="Box-Shadow is a CSS property that allows you to add a shadow to an element and filter:drop-shadow is a CSS filter that adds a Drop-Shadow effect to an element.">
    <link rel="shortcut icon" href="favicon.png" type="image/x-icon">
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="container">
        <h2 class="first"> Box Shadow </h2>
        <h4>Vs</h4>
        <h2 class="second"> Filter Drop Shadow </h2>
    </div>
</body>
</html>


And here is an example of CSS for box-shadow and drop-shadow:
@import url("https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #333;
}
.container{
    position: relative;
    width: 900px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    flex-wrap: wrap;
}
.container h2{
    font-size: 5em;
    line-height: 1em;
    padding: 5px 20px;
    margin: 15px;
    text-align: center;
    transition: .3s ease;
}
.container h4{
    font-size: 1.3em;
    color: #777;
    margin-bottom: -10px;
}
.container h2.first{
    border-radius: 20px;
    color: #fff;
    box-shadow: -3px -3px 2px rgba(255, 255, 255, 0.3),
                5px 5px 5px rgba(0, 0, 0, 0.2),
                15px 15px 15px rgba(0, 0, 0, 0.2);
}
.container h2.second{
    color: #333;
    filter: drop-shadow(-3px -3px 2px rgba(255, 255, 255, 0.3))
            drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.2))
            drop-shadow(15px 15px 15px rgba(0, 0, 0, 0.2));
}
@media screen and (max-width: 668px){
    .container h2{
        font-size: 3.6em;
    }
}



Download the source code of this project-

   



what is Box-Shadow and Filter: Drop-Shadow Effect in CSS, Creating Stunning Visuals with CSS Box-Shadow and Filter: Drop-Shadow Effect, Useful Tips, and Tricks for Working with CSS Box-Shadow and Filter: Drop-Shadow Effect, What is Box-Shadow and Filter: Drop-Shadow Effect in CSS, Understanding the box-shadow and filter: drop-shadow Effects in CSS, box-shadow, and filter:drop-shadow Effects in Modern Web Design, A Comprehensive Guide to Using the Drop-shadow Effect in CSS, A Comprehensive Guide to Using the Box-shadow Effect in CSS

Post a Comment

0Comments

Please do not enter any spam link in the comment box.

Post a Comment (0)