css3 linear gradients– Diagonal

Hi friends in this post I am sharing linear gradients in diagonal method.Already we have discussed linear gradients from top to bottom css3 gradients-Linear method , CSS3 Gradients -Radial Gradient method  and css3 gradients linear method left to right .

 

linear-gradient-diagonal

 

Keep in mind css3 gradients will not work older browsers in general . Another thing in order to work gradients in all browsers you have write separate syntax for browsers.

For chrome =“-webkit-“

For firefox=”-moz-”

For safari=”-webkit-”

For opera=”-o-”

In this type we have to specify both the horizontal and vertical starting positions.This linear gradient  starts at top left  and goes to bottom right .

Syntax

background: linear-gradient(direction, color-stop1, color-stop2, ...);

 

Already we have explained how to create a html file in notepad.Kindly check that and now copy next paste the following code in that html file.Open with above mentioned browsers.

 

<html>
<head>
<style>
#grad1 {
    height: 250px;
    width: 250px;
 
   background: -webkit-linear-gradient(left top, brown , yellow); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(bottom right,  brown, yellow); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(bottom right,  brown, yellow); /* For Firefox 3.6 to 15 */
    background: linear-gradient( bottom right,  brown , yellow); /*  Syntax  */
}
.bor{width:550px;border-width: 1px;border-color:black;border-style:dashed;}
</style>
</head>
<body>

<h3>Linear Gradient - Diagonal</h3>
<div id="grad1"></div>

<p class="bor"><strong>Note:</strong> Internet Explorer 9 and earlier versions do not support gradients.</p>

</body>
</html>

Finally you will get the output like above image . Print Friendly and PDF

SHARE

About me

Hi. I am interested in blogging.And sometimes play with webdesign,web development,domain sale,designing logo and more.

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment

Pages