2020-04-10

80s stripe effect in CSS


A decorative rainbow stripe, reminiscent of the effects used on things such as VHS cassette boxes in the late 1980s and early 1990s, implemented in pure CSS.

Optional cut-through text can be supplied using the data-text attribute on the styled element.

<p>
  Here is some text before the stripe.
</p>
<hr class="stripe-eighties" data-text="VHS" />
<p>
  Here's some more text after the stripe.
</p>
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@900&display=swap');

body {
  font-family: sans-serif;
  font-size: 24px;
  background-color: #231123;
  color: #fff;
}

.stripe-eighties {
  height: 0px;
  overflow: visible;
  margin-bottom: 80px;
  
  position: relative;
  
  font-family: 'Raleway';
  font-weight: 900;
  letter-spacing: 10px;
  font-size: 85px;
  color: #fff;
  
  border: 2px solid #a22c29;
  box-shadow: 0px 8px 0px 0px #ff9b71,
              0px 12px 0px 0px #ff9b71,
              0px 20px 0px 0px #e8db7d,
              0px 24px 0px 0px #e8db7d,
              0px 28px 0px 0px #e8db7d,
              0px 36px 0px 0px #558c8c,
              0px 40px 0px 0px #558c8c,
              0px 44px 0px 0px #558c8c,
              0px 48px 0px 0px #558c8c;
}

.stripe-eighties::before {
  content: attr(data-text);
  
  position: absolute;
  left: 50px;
  top: -30px;
  
  -webkit-text-stroke: 8px #231123;
}

.stripe-eighties::after {
  content: attr(data-text);
  
  position: absolute;
  left: 50px;
  top: -30px;
}