Languages
[Edit]
EN

CSS - box-shadow effect on top and bottom only

0 points
Created by:
Kevin
797

In this article, we would like to show you how to add box-shadow effect at the top and bottom only using CSS.

Quick solution:

.element {
    box-shadow: 0px 5px 5px gray, 0px -5px 5px gray; /* box-shadow: top-style, bottom-style; */
}

 

Practical example

In this example, we insert two styles into the box-shadow property. 

// ONLINE-RUNNER:browser;

<!DOCTYPE html>
<html>
<head>
  <style>

	.element {
        margin-top: 20px;
        box-shadow: 0px 5px 5px gray, 0px -5px 5px gray;  /*   <----- required   */
    }

  </style>
</head>
<body>
  <div class="element">
    some text here...
  </div>
</body>
</html>

Note:

This solution is just a combination of two styles that you can find in the following articles:

  1. CSS - box-shadow effect at the top only

  2. CSS - box-shadow effect on bottom only

 

See also

  1. CSS - box-shadow effect at the top only

  2. CSS - box-shadow effect on bottom only

  3. CSS - box-shadow example

References

  1. box-shadow - CSS: Cascading Style Sheets | MDN
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join