ldemo<\/a>)<\/figcaption><\/figure>\n\n\n\nThe gradient goes around the point of coordinates, x,y<\/code>, where the two straight lines intersect. It starts from an angle, \u03b2<\/code>, which is the angle of the line segment that’s closest to the top-right corner, then has hard stops at \u03b1<\/code>, 50%<\/code> (or 180\u00b0<\/code>) and 180\u00b0 + \u03b1<\/code>.<\/p>\n\n\n\nIf we want to have multiple elements with similar such patterns created with the help of different intersecting lines and different palettes, we have the perfect use case for CSS variables:<\/p>\n\n\n\n
.panel {\n background: \n conic-gradient(from var(--b) at var(--xy), \n var(--c0) var(--a), var(--c1) 0% 50%, \n var(--c2) 0% calc(180deg + var(--a)), var(--c3) 0%);\n}<\/code><\/pre>\n\n\n\nAll we have to do is set the position (--xy<\/code>), the start angle (--b<\/code>), the first angle (--a<\/code>) and the palette (--c0<\/code> through --c3<\/code>).<\/p>\n\n\n\n.panel {\n \/* same as before *\/\n \n &:nth-child(1) {\n --xy: 80% 65%; \n --b: 31deg;\n --a: 121deg; \n --c0: #be5128;\n --c1: #ce9248;\n --c2: #e4c060;\n --c3: #db9c4e\n }\n \n \/* similarly for the other panels *\/\n}<\/code><\/pre>\n\n\n\nInstead of hardcoding, we could also generate these values randomly or extract them from a data object with the help of a CSS or HTML preprocessor. In this second case, we’d set these custom properties inline, which is precisely what I did in the Pen below:<\/p>\n\n\n\n