how can we add noise to linear-gradient background?
body{
height: 100vh;
background:
linear-gradient(red, transparent ),
linear-gradient(to top left, blue, transparent),
linear-gradient(to top right, rgb(124, 211, 134), transparent );
background-blend-mode: screen;
}
CodePudding user response:
It is possible with more than 2 colors using ::pseudo
element.
@import "https://cdn.jsdelivr.net/gh/KunalTanwar/normalize/css/normalize.inter.min.css";
body {
height: 100%;
display: grid;
place-items: center;
}
.container {
width: 150px;
aspect-ratio: 1/1;
background-image: linear-gradient(to right, #833ab4, #fd1d1d, #fcb045);
}
.container::after {
content: "";
position: absolute;
inset: 0 0 0 0;
width: 100%;
height: 100%;
mix-blend-mode: multiply;
background-repeat: no-repeat;
background-position: center center;
background-image: url(https://grainy-gradients.vercel.app/noise.svg);
}
<div ></div>
CodePudding user response:
Here is a CSS only solution
body {
height: 100vh;
background:
repeating-conic-gradient(#0000 0.000045%, #000d 0.0005%), /* your noise */
linear-gradient(red, transparent),
linear-gradient(to top left, blue, transparent),
linear-gradient(to top right, rgb(124, 211, 134), transparent);
background-blend-mode: overlay, screen, screen;
}