Learn how to use CSS box shadow property - Source Code

The box-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas.

A box shadow is described by X and Y offsets relative to the element, blur and spread radius, and color.

HTML - Markup

<div class="box-container">

<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>


CSS - Styles



box-shadow: horizontal-offset | vertical-offset | blur-radius | Color;

/*Example with values*/
box-shadow: 10px 5px 5px black;

The horizontal offset (required) of the shadow, positive means the shadow will be on the right of the box, a negative offset will put the shadow on the left of the box.

The vertical offset (required) of the shadow, a negative one means the box-shadow will be above the box, a positive one means the shadow will be below the box.

The blur radius (required), if set to 0 the shadow will be sharp, the higher the number, the more blurred it will be, and the further out the shadow will extend. For instance a shadow with 4px of horizontal offset that also has a 4px blur radius will be 8px of total shadow.

Color (required) – This takes any color value, like hex, named, rgba or hsla. If the color value is omitted, box shadows are drawn in the foreground color (text color). But be aware, older WebKit browsers (pre Chrome 20 and Safari 6) ignore the rule when color is omitted.


/*Layout style*/
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

display: flex;
flex-wrap: wrap;

/*Layout styles end here*/

/*Box & shadow styles below*/
border:2px solid #808080;
margin: 0 0 20px 20px;

box-shadow: inset 2px 5px 5px rgba(0,0,0,.55),2px 5px 5px rgba(0,128,0,.55);

To learn more about this css box shadow property visit Developer.mozilla.org

You can also create box shadows easily using this non-profit project, made by developers for developers: CSS Matic Site

Related Post(s)

» Learn how to use CSS box shadow property - Source Code

» Learn how to create an overlay effect with CSS

» How do I wrap text in a pre tag?[SOLVED]

» Animated Social Media Icons Using Font Awesome and Materialize CSS

» How to create a Fullscreen Background Video(Source Code)

collections_bookmark Category :: Css
date_range Published :: 1 year ago At: 01:13 AM
event_note Detailed Date :: Jun 06th, 2020
person Writer :: Code
4 months ago

A JavaScript library for formatting and manipulating numbers - Numeral.js

Check out this lightweight JavaScript library used for formatting and manipulating numbers.

5 months ago

All Countries Drop Down List | HTML Select Country Name

This simple country dropdown list is freely available for you to copy and use in your project forms.

5 months ago

HTML Entities Code Alphabet Discovery Using JavaScript

In this post I will show how writing just a few lines in JavaScript will allow you to render, browse and discover the alphabetical letters using a set of HTML entity codes.

5 months ago


Download YTS YIFY movies using this simple project I created using their API.

6 months ago

Display Random Advice On Your Website or Web App Using Advice Slip JSON API

Here is a short project to display the use of APIs. I decided to work with an advice API because it seemed like a fun one that I haven't worked on before.

7 months ago

How do I get a YouTube video thumbnail from YouTube using PHP

Have you ever been on youtube and admired a thumbnail of a video?

9 months ago

How to recreate Facebook's console warning

When I was inspecting some code on Facebook. I came across this interesting feature. A simple styled console warning message from Facebook to its dear users(products).

1 year ago

How To Create A Stacked Gallery Using HTML And CSS Source Code

In this post I provide you with the source code for the youtube tutorial I made on how to create a Stacked image gallery Using HTML and CSS.