Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <style> #grad1 { height: 100px; background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(0deg, red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(0deg, red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(0deg, red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(0deg, red, yellow); /* Standard syntax (must be last) */ } #grad2 { height: 100px; background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(90deg, red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(90deg, red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(90deg, red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(90deg, red, yellow); /* Standard syntax (must be last) */ } #grad3 { height: 100px; background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(180deg, red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(180deg, red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(180deg, red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(180deg, red, yellow); /* Standard syntax (must be last) */ } #grad4 { height: 100px; background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(-90deg, red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(-90deg, red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(-90deg, red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(-90deg, red, yellow); /* Standard syntax (must be last) */ } </style> </head> <body> <h3>Linear Gradients - Using Different Angles</h3> <div id="grad1" style="color:white;text-align:center;">0deg</div><br> <div id="grad2" style="color:white;text-align:center;">90deg</div><br> <div id="grad3" style="color:white;text-align:center;">180deg</div><br> <div id="grad4" style="color:white;text-align:center;">-90deg</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_angles by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 13 Mar 2016 11:02:58 GMT --> </html>
Result: