Gradient use in css3
Gradients are smooth transitions between two or more specified colors.
The CSS gradient feature was introduced by Webkit about two years back, but was not very successful as most popular browers didn't support the feature. But now that is set to change with the arrival of CSS3 which supports gradients, specifically, linear and radial gradients. CSS Gradients are supported in FF3.6+, Safari 2+ and Google Chrome and IE5+.
Use this demo to create CSS background-image gradients. The CSS markup works in browsers (including Internet Explorer 10, Chrome, Firefox, Opera, Safari) that support CSS3 gradients in unprefixed form or with any of the following vendor prefixes: -ms-, -moz-, -o-, -webkit-.
The CSS gradient feature was introduced by Webkit about two years back, but was not very successful as most popular browers didn't support the feature. But now that is set to change with the arrival of CSS3 which supports gradients, specifically, linear and radial gradients. CSS Gradients are supported in FF3.6+, Safari 2+ and Google Chrome and IE5+.
Use this demo to create CSS background-image gradients. The CSS markup works in browsers (including Internet Explorer 10, Chrome, Firefox, Opera, Safari) that support CSS3 gradients in unprefixed form or with any of the following vendor prefixes: -ms-, -moz-, -o-, -webkit-.
Linear Gradient (Top → Bottom)
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#linearBg2 {
/* fallback */
background-color: #1a82f7;
background: url(images/linear_bg_2.png);
background-repeat: repeat-x;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#2F2727));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #2F2727, #1a82f7);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #2F2727, #1a82f7);
/* IE 10 */
background: -ms-linear-gradient(top, #2F2727, #1a82f7);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #2F2727, #1a82f7);
}
------------------------------------------------------------------------------------------------------------------------------------------------------
Linear Gradient (Left → Right)
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#linearBg1 {
/* fallback */
background-color: #1a82f7;
background-image: url(images/linear_bg_1.png);
background-repeat: repeat-y;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, left top, right top, from(#1a82f7), to(#2F2727));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(left, #2F2727, #1a82f7);
/* Firefox 3.6+ */
background: -moz-linear-gradient(left, #2F2727, #1a82f7);
/* IE 10 */
background: -ms-linear-gradient(left, #2F2727, #1a82f7);
/* Opera 11.10+ */
background: -o-linear-gradient(left, #2F2727, #1a82f7);
} -----------------------------------------------------------------------------------------------------------------------------------------------------
Linear Gradient (with Even Stops)
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#even-stops { /* fallback DIY*/ /* Safari 4-5, Chrome 1-9 */ background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.25, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.75, #1a82f7), to(#2F2727)); /* Safari 5.1+, Chrome 10+ */ background: -webkit-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727); /* Firefox 3.6+ */ background: -moz-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727); /* IE 10 */ background: -ms-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727); /* Opera 11.10+ */ background: -o-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727); }
-----------------------------------------------------------------------------------------------------------------------------------------------------
Linear Gradient (with Specified Arbitrary Stops)
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#arbitrary-stops { /* fallback DIY*/ /* Safari 4-5, Chrome 1-9 */ background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.05, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.95, #1a82f7), to(#2F2727)); /* Safari 5.1+, Chrome 10+ */ background: -webkit-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727); /* Firefox 3.6+ */ background: -moz-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727); /* IE 10 */ background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727); /* Opera 11.10+ */ background: -o-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727); }
-----------------------------------------------------------------------------------------------------------------------------------------------------
Radial Gradient (Centered, Full Size)
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#radial-center { /* fallback */ background-color: #2F2727; background-image: url(images/radial_bg.png); background-position: center center; background-repeat: no-repeat; /* Safari 4-5, Chrome 1-9 */ /* Can't specify a percentage size? Laaaaaame. */ background: -webkit-gradient(radial, center center, 0, center center, 460, from(#1a82f7), to(#2F2727)); /* Safari 5.1+, Chrome 10+ */ background: -webkit-radial-gradient(circle, #1a82f7, #2F2727); /* Firefox 3.6+ */ background: -moz-radial-gradient(circle, #1a82f7, #2F2727); /* IE 10 */ background: -ms-radial-gradient(circle, #1a82f7, #2F2727); /* Opera cannot do radial gradients yet */ }
-----------------------------------------------------------------------------------------------------------------------------------------------------
Radial Gradient (Positioned, Sized)
Warning: Not Consistent Among Browsers
CSS
------------------------------------------------------------------------------------------------------------------------------------------------------
#radial-position { /* fallback */ background-color: #2F2727; background-image: url(images/radial_fancy.png); background-position: 80% 20%; background-repeat: no-repeat; /* Safari 4-5, Chrome 1-9 */ background: -webkit-gradient(radial, 80% 20%, 0, 80% 40%, 100, from(#1a82f7), to(#2F2727)); /* Safari 5.1+, Chrome 10+ */ background: -webkit-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727); /* Firefox 3.6+ */ background: -moz-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727); /* IE 10 */ background: -ms-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727); /* Opera cannot do radial gradients yet */ }
-----------------------------------------------------------------------------------------------------------------------------------------------------
Try it and enjoy.
Subscribe to:
Post Comments
(
Atom
)
Labels
CSS
(
5
)
CSS3
(
3
)
Designer
(
1
)
Designs
(
7
)
Fullscreen
(
1
)
Gradients
(
1
)
HTML5
(
2
)
Jquery
(
1
)
Layout
(
2
)
Logo
(
2
)
PSD
(
16
)
Photoshop
(
18
)
Slider
(
1
)
Wallpaper
(
6
)
abstracts
(
12
)
adobe
(
7
)
attractive
(
2
)
backgrounds
(
9
)
banners
(
3
)
beauty
(
1
)
bottle
(
1
)
business
(
19
)
collection
(
8
)
coming soon psd
(
1
)
corporate
(
2
)
creative
(
19
)
design
(
19
)
download
(
22
)
downloads
(
54
)
free
(
13
)
free download
(
7
)
free fonts
(
4
)
graphics
(
4
)
grunge
(
1
)
holiday
(
1
)
hot
(
1
)
html template
(
2
)
icons
(
6
)
in psd
(
19
)
interface
(
2
)
label
(
2
)
loading bar design
(
1
)
menu
(
2
)
mockup designs
(
2
)
music banner design
(
1
)
nature banner design
(
1
)
navinations
(
1
)
print design
(
2
)
psd templates
(
6
)
radio buttons
(
1
)
responsive
(
3
)
restaurant template design
(
2
)
ribbons
(
2
)
sale
(
1
)
sale vector designs
(
1
)
salon
(
1
)
shape
(
1
)
skyline
(
1
)
submit buttons design
(
1
)
summer
(
2
)
template design
(
2
)
templates
(
3
)
twitter
(
1
)
vector
(
11
)
vector design
(
3
)
vectors
(
3
)
we template
(
3
)
web button
(
3
)
web design
(
5
)
website templates
(
2
)

No comments :
Post a Comment