A linear gradient with a specified angle: - HTML CSS CSS

HTML CSS examples for CSS:Color

Description

A linear gradient with a specified angle:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#grad1 {<!--from ww w  .ja va  2s. c o m-->
    height: 100px;
    background: -webkit-linear-gradient(0deg, yellow,blue,black,pink); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(0deg, yellow,blue,black,pink); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(0deg, yellow,blue,black,pink); /* For Firefox 3.6 to 15 */
    background: linear-gradient(0deg, yellow,blue,black,pink); /* Standard syntax (must be last) */
}

#grad2 {
    height: 100px;
    background: -webkit-linear-gradient(90deg, yellow,blue,black,pink); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(90deg, yellow,blue,black,pink); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(90deg, yellow,blue,black,pink); /* For Firefox 3.6 to 15 */
    background: linear-gradient(90deg, yellow,blue,black,pink); /* Standard syntax (must be last) */
}

#grad3 {
    height: 100px;
    background: -webkit-linear-gradient(180deg, yellow,blue,black,pink); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(180deg, yellow,blue,black,pink); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(180deg, yellow,blue,black,pink); /* For Firefox 3.6 to 15 */
    background: linear-gradient(180deg, yellow,blue,black,pink); /* Standard syntax (must be last) */
}

#grad4 {
    height: 100px;
    background: -webkit-linear-gradient(-90deg, yellow,blue,black,pink); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(-90deg, yellow,blue,black,pink); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(-90deg, yellow,blue,black,pink); /* For Firefox 3.6 to 15 */
    background: linear-gradient(-90deg, yellow,blue,black,pink); /* Standard syntax (must be last) */
}
</style>
</head>
<body>

<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>



</body>
</html>

Related Tutorials