I'm trying to generate a gradient background with linear-gradient in CSS. Here's an example codepen https://codepen.io/JSislife/pen/vYxrYEv. As you can see on the bottom right corner there is no transition of colors between orange and white; but the top left is the opposite. How do I make the top left not have a color transition as well?
1 Answer
Just as @G-Cyrillus mentioned in the comments, if you add color stops to your linear-gradient you can create gradient sections that don't fade into eachother but have defined start/stop positions.
body {
margin: 0;
padding: 0;
background: linear-gradient(135deg, white 0% 15%, #bd6430 15% 70%, white 70%) fixed;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
</head>
<body>
<div id='home'></div>
</body>
</html>
background: linear-gradient(135deg, white 15%,#bd6430 15% 70%, white 70%) fixed;?#bd6430 15% 70%? Edit: nevermind, I see that you started the color at 15% of the width to match the first color placement