background: radial-gradient(circle 100px at right top, transparent 19%, white 20%) top right / 100%51% no-repeat, radial-gradient(circle 100px at right bottom, transparent 19%, white 20%) bottom right/ 100%51% no-repeat;
首先通过circle 100px at right top, transparent 19%, white 20%设置一个半径为100px,圆心位于右上角的径向渐变,从而得到一个1/4圆的形状,然后设置渐变色,从圆心到19%处为透明,显示背景颜色,从19%到20%为透明到白色的渐变,从20%到100%为白色
通过top和right指定该块背景的位置在右上角,之后的100% 51%指定该块背景的大小,例如如果设置为top right / 50% 50%,那么这块背景就只占据元素右上角且面积为元素的1/4,如果设置为top / 50% 50%,那么这块背景就只占据元素的上半部分,且居中,大小仍为元素的1/4
background: radial-gradient(circle 100px at right top, orange 19%, red 20%) top right / 80%51% no-repeat, radial-gradient(circle 100px at right bottom, purple 19%, lightblue 20%) bottom / 50%51% no-repeat;
那么接下来右侧卡片也就同理了,只需要将缺口设置为左上角和左下角即可。
1 2 3 4 5 6 7 8 9 10 11 12
.ticket-card__content{ width: 300px; padding-left: 40px; background: radial-gradient(circle 100px at left top, transparent 19%, white 20%) top left / 100%51% no-repeat, radial-gradient(circle 100px at left bottom, transparent 19%, white 20%) bottom left / 100%51% no-repeat; border-radius: 5px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; position: relative; }
.ticket-card__title__container{ width: 150px; height: 150px; background: radial-gradient(circle 100px at right top, transparent 19%, white 20%) top right / 100%51% no-repeat,radial-gradient(circle 100px at right bottom, transparent 19%, white 20%) bottom right / 100%51% no-repeat; border-radius: 5px; overflow: hidden; filter: drop-shadow(1px1px3px lightgray); }
.ticket-card__content{ width: 300px; padding-left: 40px; background: radial-gradient(circle 100px at left top, transparent 19%, white 20%) top left / 100%51% no-repeat,radial-gradient(circle 100px at left bottom, transparent 19%, white 20%) bottom left / 100%51% no-repeat; border-radius: 5px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; position: relative; filter: drop-shadow(1px1px3px lightgray); } </style>