Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a scheduler-like component on my web application which consists of a lot of divs. Some of these divs can be completely red, some can be completely white, some can be half-red half-white and some can be striped red-white.

The ones that are half-red half-white have this background in css:

background: linear-gradient(169deg, rgba(240,91,38,0.30) 49%, rgb(255, 255, 255) 51%);

And they look like this: enter image description here

The ones that are striped have this css code:

background: repeating-linear-gradient(45deg, #ffd6cc, #ffd6cc 10px, #ffffff 10px, #ffffff 20px)

And they look like this" enter image description here

I am stuck on what I should do next - I need to have cells that are combination of both of the above. So the div needs to be like in the first image, but instead of the whole upper triangle being colored red, the triangle should be striped. Is there a way to do this with css?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
411 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can have multiple gradients per background

.half-cell {
  background: linear-gradient(162deg, rgba(255, 255, 255, 0.0) 49%, rgb(255, 255, 255) 51%), repeating-linear-gradient(45deg, #ffd6cc, #ffd6cc 10px, #ffffff 10px, #ffffff 20px);
}

div {
  width: 606px;
  height: 200px;
  border: 1px solid black;
}
<div class="half-cell"></div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...