I ran into a problem using linear-gradient on a particularly large element.
On smaller elements, a hard edge can be achieved using the following:
background-image: linear-gradient(180deg, #000, #000 33%, #0f0 0);
However, when the element is very large, the edge is soft. In the following image and example below, you can see that the second version has a soft edge when the element is very large and the same gradient is applied.

I tried many variations of the linear gradient and could not achieve a sharp advantage in the large version. Is there a way to apply a hard edge gradient to a large element?
HTML example:
div { height: 5000px; background-repeat: no-repeat; margin-bottom: 1em; background-image: linear-gradient(180deg, #000, #000 20px, #0f0 0); } div:first-child { height: 100px; }
<div></div> <div></div>
edit
The purpose of this gradient is to use it with a different background image, so I prefer methods that are compatible with the following (do not close the image):
div { height: 5000px; background-repeat: no-repeat; margin-bottom: 1em; background-image: url(http://placehold.it/600x20), linear-gradient(180deg, #000, #000 20px, #0f0 0); }
<div></div>
Edit 2
Thanks to @Tarun, this is browser related. Image above is a screenshot from Chromium 45. Safari and Firefox display correctly.
Edit 3
There is an open bug report for Chromium on this issue.
source share