CSS defines functions to repeat gradients (#tilPost)

Today I learned a nifty and quick fact about CSS gradients. It surprised me that I didn’t come across it before. CSS includes functions to define gradients as background images:

linear-gradient
radial-gradient
conic-gradient

The l…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Today I learned a nifty and quick fact about CSS gradients. It surprised me that I didn't come across it before. CSS includes functions to define gradients as background images:

The linear, radial and conic gradients are not the only gradient functions, though. There are three very similar CSS functions that enable you to repeat a pattern in CSS.

.repeating-linear {
  background: repeating-linear-gradient(
    var(--primary) 0 1em,
    var(--secondary) 1em 2em
  );
}

.repeating-radial {
  background: repeating-radial-gradient(
    var(--primary) 0 1em,
    var(--secondary) 1em 2em
  );
}

.repeating-conic {
  background: repeating-conic-gradient(
    var(--primary) 0 36deg,
    var(--secondary) 36deg 72deg
  );
}

You can read more about these functions on MDN:

Have a look at the devsheet below to see the difference between all these CSS functions.

Devsheet showing normal and repeating CSS gradients


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2021-03-12T23:00:00+00:00) CSS defines functions to repeat gradients (#tilPost). Retrieved from https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/

MLA
" » CSS defines functions to repeat gradients (#tilPost)." Stefan Judis | Sciencx - Friday March 12, 2021, https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/
HARVARD
Stefan Judis | Sciencx Friday March 12, 2021 » CSS defines functions to repeat gradients (#tilPost)., viewed ,<https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » CSS defines functions to repeat gradients (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/
CHICAGO
" » CSS defines functions to repeat gradients (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/
IEEE
" » CSS defines functions to repeat gradients (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/. [Accessed: ]
rf:citation
» CSS defines functions to repeat gradients (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2021/03/12/css-defines-functions-to-repeat-gradients-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.