I am trying to make a linear-gradient with percentage breakpoints while using "background-attachment: fixed". It is not working as I expected.
I've made a very simple fiddle about my question.
https://jsfiddle.net/f8v1h0ac/
HTML
<body>
<header>
Header
</header>
<main>
Main
</main>
</body>
CSS
body {
margin: 0;
padding: 0;
}
header {
width: 100%;
height: 300px;
background-attachment: fixed;
/* background-image: linear-gradient(to bottom, black 0px, white 300px); */
/* The code above is working but the code below is not. Note that the color at the bottom line of header is supposed to be white. */
background-image: linear-gradient(to bottom, black 0%, white 100%);
}
main {
height: 2000px;
}
PS: I guess this happens because the gradient's height is respective to the window height. But I don't have a clue how to solve this problem.