Check out my previous post about text-shadow , box-shadow and Draw simple drawing board application using HTML5 Canvas.
This post is about how to use gradient background or gradient color without using any image which is purely using HTML5
CSS3 style sheet.
let’s look at the syntax:
background: linear-gradient([Direction] [color] [percentage]);
Direction: (Top/45 deg/Left/Radial) in which direction you need to spread color
Color: which color to fill
Percentage: what percentage of the areal to be filled with Color.
there are multiple syntax supported by different browser.
check out the following CSS3 syntax for different browser.
background: #b3dced; /* Old browsers */ /* IE9 SVG, needs conditional override of 'filter' to 'none' */ background: -moz-linear-gradient(-45deg, #b3dced 0%, #29b8e5 50%, #bce0ee 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#b3dced), color-stop(50%,#29b8e5), color-stop(100%,#bce0ee)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(-45deg, #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(-45deg, #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(-45deg, #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* IE10+ */ background: linear-gradient(135deg, #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3dced', endColorstr='#bce0ee',GradientType=1 ); /* IE6-8 fallback on horizontal gradient */
check out the following ultimage css3 gradient generators from others:
http://www.colorzilla.com/gradient-editor/
and one more