A backgrond like this with same height of red and yellow.
相关问题
- image gradient angle computation
- Gradient as a Buttons BorderColor?
- How to do a Gradient effect from topLeft to bottto
- How to add gradient to font face (CSS)?
- How does tf.gradients manages complex functions?
相关文章
- Multiple points/colors gradient on HTML5 canvas
- WPF 3D - mapping gradient brush on complex geometr
- Programmatic gradient stops with Javascript
- One colour gradient according to value in column s
- Backpropagating gradients through nested tf.map_fn
- Fill matplotlib polygon with a gradient between ve
- ChartJS Doughnut Charts Gradient Fill
- How to get gradient values using keras.backend.gra
Using Colorzilla's gradient generator, just set two colors to the same % location and you'll get a hard edge between the two colors.
Colorzilla's gradient generator is a nice start, but the code is awful in my opinion.
You'll never easily see if the colors are right, there's no output of short hex codes like
#ff0
and – most important in comparison to the answer above – the W3C standard has changed toto <side-or-corner>
.So given your question after a flat gradient with same height of red and yellow area this is my preferred code:
See example on CodePen.
Also note, that you can leave out the deprecated
filter
property for IEs in this case, simply because there are no color stops included.If you know the exact height of the box, you could also work with
px
values instead of the%
values for the color stops.Updated 2016-01-16: Neither
-o-
vendor prefix is necessary, nor-ms-
(as IE 10 is the first IE to support gradients and it does support the W3C standards syntax). See http://caniuse.com/#feat=css-gradientsUpdated 2016-01-27: Prefer lowercase hex color values for better gzipping, and clearly state
background-color
andbackground-image
instead ofbackground
. Also removedto bottom
as it's the default value.