Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <style> #grad1 { height: 200px; background: -webkit-linear-gradient(left, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Firefox 3.6 to 15 */ background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); /* Standard syntax (must be last) */ } </style> </head> <body> <h3>Linear Gradient - Transparency</h3> <p>To add transparency, we use the rgba() function to define the color stops. The last parameter in the rgba() function can be a value from 0 to 1, and it defines the transparency of the color: 0 indicates full transparency, 1 indicates full color (no transparency).</p> <div id="grad1"></div> <p><strong>Note:</strong> Internet Explorer 9 and earlier versions do not support gradients.</p> </body> <!-- Mirrored from www.w3schools.com/css/tryit.asp?filename=trycss3_gradient-linear_trans by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 13 Mar 2016 11:02:58 GMT --> </html>
Result: