How to make both top and bottom border shadow

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

Show hidden characters

Box Shadow .box {height: 150px;width: 300px;margin: 20px;border: 1px solid

ccc; } .top {box-shadow: 0 -5px 5px -5px

333; } .right {box-shadow: 5px 0 5px -5px

333; } .bottom {box-shadow: 0 5px 5px -5px

333; } .left {box-shadow: -5px 0 5px -5px

333; } .all {box-shadow: 0 0 5px

333; }

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.

The box-shadow property enables you to cast a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).

Box-shadow generator is an interactive tool allowing you to generate a box-shadow.

/* Keyword values */
box-shadow: none;
/* A color and two length values */
/*  |  |  */
box-shadow: red 60px -16px;
/* Three length values and a color */
/*  |  |  |  */
box-shadow: 10px 5px 5px black;
/* Four length values and a color */
/*  |  |  |  |  */
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
/* inset, length values, and a color */
/*  |  |  |  */
box-shadow: inset 5em 1em gold;
/* Any number of shadows, separated by commas */
box-shadow:
  3px 3px red inset,
  -1em 0 0.4em olive;
/* Global values */
box-shadow: inherit;
box-shadow: initial;
box-shadow: revert;
box-shadow: revert-layer;
box-shadow: unset;

Specify a single box-shadow using:

  • Two, three, or four

    box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    0 values.

    • If only two values are given, they are interpreted as

      box-shadow =

       [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # hash%5Fmark) =
       <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark)

      1 and box-shadow =

       [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # hash%5Fmark) =
       <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark)

      2 values.
    • If a third value is given, it is interpreted as a

      box-shadow =

       [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # hash%5Fmark) =
       <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark)

    • If a fourth value is given, it is interpreted as a

      box-shadow =

       [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # hash%5Fmark) =
       <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

      double%5Fampersand)
       <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax
      
      # question%5Fmark)

      4.
  • Optionally, the

    box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    5 keyword.
  • Optionally, a value.

To specify multiple shadows, provide a comma-separated list of shadows.

Optional

Specifies color for the shadow. See

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

6 values for possible keywords and notations. If not specified, the value of the

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

9 property defined in the parent element is used.

Specifies the offset length of the shadow. This parameter accepts two, three, or four values. Third and fourth values are optional. They are interpreted as follows:

  • If two values are specified, they are interpreted as

    box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    1 (horizontal offset) and box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    2 (vertical offset) values. Negative box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    1 value places the shadow to the left of the element. Negative box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    2 value places the shadow above the element. If not specified, the value of

    You may shoot me with your words,
    You may cut me with your eyes,
    You may kill me with your hatefulness,
    But still, like air, I'll rise.

    — Maya Angelou

    5 is used for the missing length. If both box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    1 and box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    2 are set to

    You may shoot me with your words,
    You may cut me with your eyes,
    You may kill me with your hatefulness,
    But still, like air, I'll rise.

    — Maya Angelou

    5, the shadow is placed behind the element (and may generate a blur effect if box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    3 and/or box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    4 is set).
  • If three values are specified, the third value is interpreted as

    box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    3. The larger this value, the bigger the blur, so the shadow becomes bigger and lighter. Negative values are not allowed. If not specified, it will be set to

    You may shoot me with your words,
    You may cut me with your eyes,
    You may kill me with your hatefulness,
    But still, like air, I'll rise.

    — Maya Angelou

    5 (meaning that the shadow's edge will be sharp). The specification does not include an exact algorithm for how the blur radius should be calculated; however, it does elaborate as follows:
    …for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow's edge, and that ranges from the full shadow color at the radius endpoint inside the shadow to fully transparent at the endpoint outside it.
  • If four values are specified, the fourth value is interpreted as

    box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    hash%5Fmark)

    = <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    double%5Fampersand)

    <'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

    question%5Fmark)

    4. Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. If not specified, it will be set to

    You may shoot me with your words,
    You may cut me with your eyes,
    You may kill me with your hatefulness,
    But still, like air, I'll rise.

    — Maya Angelou

    5 (that is, the shadow will be the same size as the element). Optional

Changes the shadow from an outer box-shadow to an inner box-shadow (as if the content is pressed into the box). Inset shadows are drawn inside the box's border (even if the border is transparent), and they appear above the background but below the content. By default, the shadow behaves like a drop shadow, giving the appearance that the box is elevated above its content. This is the default behavior when

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

5 is not specified.

When animating shadows, such as when multiple shadow values on a box transition to new values on hover, the values are interpolated. Interpolation determines intermediate values of properties, such as the blur radius, spread radius, and color, as shadows transition. For each shadow in a list of shadows, the color, x, y, blur, and spread transition; the color as

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

6, and the other values as

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

0s.

In interpolating multiple shadows between two comma-separated lists of multiple box shadows, the shadows are paired, in order, with interpolation occurring between paired shadows. If the lists of shadows have different lengths, then the shorter list is padded at the end with shadows whose color is

blockquote {
  padding: 20px;
  box-shadow:
    inset 0 -3em 3em rgba(0, 200, 0, 0.3),
    0 0 0 2px white,
    0.3em 0.3em 1em rgba(200, 0, 0, 0.6);
}

9, and X, Y, and blur are

You may shoot me with your words,
You may cut me with your eyes,
You may kill me with your hatefulness,
But still, like air, I'll rise.

— Maya Angelou

5, with the inset, or lack of inset, being set to match. If in any pair of shadows, one has

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

5 set and the other does not, the entire shadow list is uninterpolated; the shadows will change to the new values without an animating effect.

Initial value

Hello World

2Applies toall elements. It also applies to

Hello World

3.InheritednoComputed valueany length made absolute; any specified color computed; otherwise as specifiedAnimation typea

box-shadow = [#](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

hash%5Fmark)

= <'box-shadow-color'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

[[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-offset'> [[](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) <'box-shadow-blur'> <'box-shadow-spread'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets)[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark) []](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

brackets) [&&](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

double%5Fampersand)

<'box-shadow-position'>[?](https://developer.mozilla.org/en-US/docs/Web/CSS/Value%5Fdefinition%5Fsyntax

question%5Fmark)

In this example, we include three shadows: an inset shadow, a regular drop shadow, and a 2px shadow that creates a border effect (we could have used an

Hello World

4 instead for that third shadow).

HTML

You may shoot me with your words,
You may cut me with your eyes,
You may kill me with your hatefulness,
But still, like air, I'll rise.

— Maya Angelou

CSS

blockquote {
  padding: 20px;
  box-shadow:
    inset 0 -3em 3em rgba(0, 200, 0, 0.3),
    0 0 0 2px white,
    0.3em 0.3em 1em rgba(200, 0, 0, 0.6);
}

Result

When the

Hello World

5,

Hello World

6, and

Hello World

7 are all zero, the box shadow will be a solid-colored outline of equal-size on all sides. The shadows are drawn back to front, so the first shadow sits on top of subsequent shadows. When the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners. Had we put in a border-radius of any other value, the corners would have been rounded.

We added a margin the size of the widest box-shadow to ensure the shadow doesn't overlap adjacent elements or go beyond the border of the containing box. A box-shadow does not impact box model dimensions.

How do you get a box shadow on top and bottom?

Element CSS We can get top bottom box shadow only by applying two shadows on an element. This approach will give us more control over the amount of shadow in each direction. You can played around and adjust the values of box-shadow property in our multiple box shadow generator to get more exiting results.

How do you make two shadows?

A: You get two shadows when the light is coming from two main sources, maybe two different street lamps.

How do you put a shadow on the bottom border?

CSS Box Shadow Bottom Only.

h-shadow: The horizontal offset of the shadow. ... .

v-shadow: The vertical offset of the shadow. ... .

blur: The blur radius of the shadow. ... .

spread: The spread radius of the shadow. ... .

color: The color of the shadow..

inset: Optional..

How do you add multiple box shadows?

Multiple box-shadows can be created by using commas to separate properties of each box-shadow element. Here's an example of the CSS to create multiple shadows with some blur, at mostly-transparent black colors: box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);