Using Nested Gradients

Nested Gradient
code: https://jsfiddle.net/310eyvh5/

Trying to make this:
code: https://jsfiddle.net/2hyjog3r/

Is this possible?

Evidently, it is. :shifty:

I tried here:

code: https://jsfiddle.net/0bymnj1k/1/

How do you add more colors/gradients?
More border lines.

.basic {
  width: 170px;
  height: 170px;
  padding: 5px;
  box-sizing: border-box;
  
  border: 5px solid transparent;
  
  background:
    linear-gradient(red, red) content-box,
    linear-gradient(blue, blue) padding-box,
    linear-gradient(green, green) border-box;
}

Looks like you got it :slight_smile: . If you want thin stripes, just need to adjust the height and width, and maybe padding if you’re using that too.

Probably easier just to use box-shadow with an inset.

You can add as many as you want now.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.