CSS Long Box Shadow

Web Design & Web Development

Demo

Sponsored links

 

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Long Box Shadow</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <div class="box">
        <div class="shadow"></div>
      </div>
      <h1>Long Box Shadow</h1>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 30px 15px;
}
.box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 200px;
  height: 100%;
  max-height: 200px;
  overflow: hidden;
  background-color: #db837b;
}
.shadow {
  position: relative;
  width: 100px;
  height: 100px;
  background-color: #fff;
  box-shadow: 1px 1px 0 rgb(154, 86, 80),
              2px 2px 0 rgb(154, 86, 80),
              3px 3px 0 rgb(154, 86, 80),
              4px 4px 0 rgb(154, 86, 80),
              5px 5px 0 rgb(154, 86, 80),
              6px 6px 0 rgb(154, 86, 80),
              7px 7px 0 rgb(154, 86, 80),
              8px 8px 0 rgb(154, 86, 80),
              9px 9px 0 rgb(154, 86, 80),
              10px 10px 0 rgb(154, 86, 80),
              11px 11px 0 rgb(154, 86, 80),
              12px 12px 0 rgb(154, 86, 80),
              13px 13px 0 rgb(154, 86, 80),
              14px 14px 0 rgb(154, 86, 80),
              15px 15px 0 rgb(154, 86, 80),
              16px 16px 0 rgb(154, 86, 80),
              17px 17px 0 rgb(154, 86, 80),
              18px 18px 0 rgb(154, 86, 80),
              19px 19px 0 rgb(154, 86, 80),
              20px 20px 0 rgb(154, 86, 80),
              21px 21px 0 rgb(154, 86, 80),
              22px 22px 0 rgb(154, 86, 80),
              23px 23px 0 rgb(154, 86, 80),
              24px 24px 0 rgb(154, 86, 80),
              25px 25px 0 rgb(154, 86, 80),
              26px 26px 0 rgb(154, 86, 80),
              27px 27px 0 rgb(154, 86, 80),
              28px 28px 0 rgb(154, 86, 80),
              29px 29px 0 rgb(154, 86, 80),
              30px 30px 0 rgb(154, 86, 80),
              31px 31px 0 rgb(154, 86, 80),
              32px 32px 0 rgb(154, 86, 80),
              33px 33px 0 rgb(154, 86, 80),
              34px 34px 0 rgb(154, 86, 80),
              35px 35px 0 rgb(154, 86, 80),
              36px 36px 0 rgb(154, 86, 80),
              37px 37px 0 rgb(154, 86, 80),
              38px 38px 0 rgb(154, 86, 80),
              39px 39px 0 rgb(154, 86, 80),
              40px 40px 0 rgb(154, 86, 80),
              41px 41px 0 rgb(154, 86, 80),
              42px 42px 0 rgb(154, 86, 80),
              43px 43px 0 rgb(154, 86, 80),
              44px 44px 0 rgb(154, 86, 80),
              45px 45px 0 rgb(154, 86, 80),
              46px 46px 0 rgb(154, 86, 80),
              47px 47px 0 rgb(154, 86, 80),
              48px 48px 0 rgb(154, 86, 80),
              49px 49px 0 rgb(154, 86, 80),
              50px 50px 0 rgb(154, 86, 80);
}
h1 {
  margin: 30px 0 0;
  color: #3d3935;
  font-size: 3rem;
  letter-spacing: 1px;
  text-align: center;
}
@media screen and (max-width: 480px) {
  #container {
    justify-content: flex-start;
    height: 400px;
  }
  h1 {
    margin: 10px 0 0;
    font-size: 2rem;
  }
}