Reputation: 12861
I've created a linear gradient with following CSS code for a linear gradient:
background-color: #2c2c2c;
background-image: -moz-linear-gradient(top, #444444, #222222);
background-image: -ms-linear-gradient(top, #444444, #222222);
background-image: -webkit-gradient(linear, 0 0, 0 0, from(#444444), to(#222222));
background-image: -webkit-linear-gradient(top, #444444, #222222);
background-image: -o-linear-gradient(top, #444444, #222222);
background-image: linear-gradient(top, #444444, #222222);
background-repeat: repeat-x;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#444444', endColorstr='#222222', GradientType=0);
I'm wondering how can I get this same gradient, from #444444 to #222222, to go up until the white arrow, stop, and then proceed to the bottom edge starting from #222222 and back to #444444 in the same manner above.
Thank you.
Upvotes: 1
Views: 749
Reputation: 497
You need to specify where the color stops see the 50% part.
background: #444444; /* Old browsers */
background: -moz-linear-gradient(top, #444444 0%, #222222 50%, #444444 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#444444), color-stop(50%,#222222), color-stop(100%,#444444)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* IE10+ */
background: linear-gradient(to bottom, #444444 0%,#222222 50%,#444444 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#444444',GradientType=0 ); /* IE6-9 */
Check out Ultimate CSS Gradient Generator for more info.
Upvotes: 1
Reputation: 6696
background: #000000; /* Old browsers */
background: -moz-linear-gradient(top, #000000 0%, #ff3033 50%, #000000 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000000), color-stop(50%,#ff3033), color-stop(100%,#000000)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #000000 0%,#ff3033 50%,#000000 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #000000 0%,#ff3033 50%,#000000 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #000000 0%,#ff3033 50%,#000000 100%); /* IE10+ */
background: linear-gradient(to bottom, #000000 0%,#ff3033 50%,#000000 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
Upvotes: 2
Reputation: 487
You should be able to do something like this:
background: #444444; /* Old browsers */
background: -moz-linear-gradient(top, #444444 0%, #222222 50%, #444444 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#444444), color- stop(50%,#222222), color-stop(100%,#444444)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #444444 0%,#222222 50%,#444444 100%); /* IE10+ */
background: linear-gradient(to bottom, #444444 0%,#222222 50%,#444444 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#444444',GradientType=0 ); /* IE6-9 */
A great learning tool can be found here.
Upvotes: 1