CSS3 ?????
CSS3 ????? ? ???? ? ? ??? ??? ?? ??? ???? ??? ? ????. ???? ??? ??? ???? ???? ???? ????. ??? CSS3 ?????? ???? ???? ???? ??? ???? ?? ? ????. ?? ?????? ????? ?? ????? ??? ? ?????? ?? ??? ? ? ????.
CSS3? ? ?? ??? ?????? ?????.
------?? ?????-???/?/??/???/??? ??
----??? ????? - ???? ??
CSS3 ?? ?????
?? ?????? ???? ?? ? ?? ??? ???? ???. ??. ?? ??? ???? ??? ????? ?????. ??? ???? ??(?? ??)? ??? ? ????.
??: ??: ?? ?????(??, ?? ??1, ?? ??2, ...);
?? ????? - ???? ???? ??
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> div{ width: 300px; height: 300px; margin: 0 auto; border: 1px solid; background: -webkit-linear-gradient(left,red,green,white,orange, blue); } </style> </head> <body> <div></div> </body> </html>
?? ????? - ??? ???
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> div{ width: 300px; height: 300px; margin: 0 auto; border: 1px solid; background: -webkit-linear-gradient(red,green,white,orange, blue); } </style> </head> <body> <div></div> </body> </html>
?? ????? - ???
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> div{ width: 300px; height: 300px; margin: 0 auto; border: 1px solid; background: -webkit-linear-gradient(45deg, red, white, blue); } </style> </head> <body> <div></div> </body> </html>
?? ????? ??
????? ??? ? ???? ????? ?? ??? ?? ?? ??? ??? ? ????( ???, ?, ?????, ????, ??? ??? ?).
?? ??: ?? ?????(angle, color-stop1, color-stop2);
Angle? ???? ????? ? ??? ??? ???? ?? ?? ???? ?????. ?, 0deg? ???? ?? ?????? ???, 90deg? ???? ????? ?????? ????.
??? ?? ????(Chrome, Safari, fiefox ?)? ?? ??? ????? ?????. ?, 0deg? ?? ??? ?????? ?? 90deg? ???? ?? ?????? ?????. ?? ?? 90 - x = y ??? x? ?? ???? y? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 100px; background: -webkit-linear-gradient(0deg, green, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(0deg, green, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(0deg, green, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(0deg, green, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad2 { height: 100px; background: -webkit-linear-gradient(45deg, green, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(45deg, green, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(45deg, green, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(45deg, green, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad3 { height: 100px; background: -webkit-linear-gradient(90deg, green, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(90deg, green, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(90deg, green, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(90deg, green, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad4 { height: 100px; background: -webkit-linear-gradient(-90deg, green, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(-90deg, green, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(-90deg, green, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(-90deg, green, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <h3>線性漸變 - 使用不同的角度</h3> <div id="grad1" style="color:white;text-align:center;">0deg</div><br> <div id="grad2" style="color:white;text-align:center;">45deg</div><br> <div id="grad3" style="color:white;text-align:center;">90deg</div><br> <div id="grad4" style="color:white;text-align:center;">-90deg</div> <p><strong>注意:</strong> Internet Explorer 9 及之前的版本不支持漸變。</p> </body> </html>
?? ?? ?? ??
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 200px; width: 300px; background: -webkit-linear-gradient(red, green, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(red, green, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(red, green, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(red, green, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad2 { height: 200px; width: 300px; background: -webkit-linear-gradient(red, orange, yellow, green, blue, indigo, violet); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(red, orange, yellow, green, blue, indigo, violet); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(red, orange, yellow, green, blue, indigo, violet); /* Firefox 3.6 - 15 */ background: linear-gradient(red, orange, yellow, green, blue, indigo, violet); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad3 { height: 200px; width: 300px; background: -webkit-linear-gradient(red 10%, green 85%, blue 90%); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(red 10%, green 85%, blue 90%); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(red 10%, green 85%, blue 90%); /* Firefox 3.6 - 15 */ background: linear-gradient(red 10%, green 85%, blue 90%); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <h3>顏色結(jié)點(diǎn)(均勻分布)</h3> <div id="grad1"></div> <h3>顏色結(jié)點(diǎn)(均勻分布)</h3> <div id="grad2"></div> <h3>顏色結(jié)點(diǎn)(不均勻分布)</h3> <div id="grad3"></div> </body> </html>
??: ???? ???? ??? ?? ??? ???? ????. ???? ???? ?????.
??? ??
CSS3 ?????? ???? ????? ??? ??? ??? ? ??? ? ????.
???? ???? ?? rgba() ??? ???? ?? ??? ?????. rgba() ??? ??? ????? 0?? 1 ??? ?? ? ? ??? ??? ???? ?????. 0? ?? ??? ???? 1? ?? ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 200px; width: 300px; background: -webkit-linear-gradient(left, rgba(255,0,0,0), rgba(255,0,0,1)); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* Firefox 3.6 - 15 */ background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <div id="grad1"></div> </body> </html>
???? ???? ?? rgba() ??? ???? ?? ??? ?????. rgba() ??? ??? ????? 0?? 1 ??? ?? ? ? ??? ??? ???? ?????. 0? ?? ??? ???? 1? ?? ???? ?????.
?? ????? ??
?? ?????? ????? repeating-linear-gradient() ??? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 200px; width: 400px; background: -webkit-repeating-linear-gradient(red, yellow 10%, green 20%); /* Safari 5.1 - 6.0 */ background: -o-repeating-linear-gradient(red, yellow 10%, green 20%); /* Opera 11.1 - 12.0 */ background: -moz-repeating-linear-gradient(red, yellow 10%, green 20%); /* Firefox 3.6 - 15 */ background: repeating-linear-gradient(red, yellow 10%, green 20%); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <div id="grad1"></div> </body> </html>
CSS3 ??? ?????
??? ?????? ???? ?????.
??? ?????? ????? ?? ? ?? ?? ??? ???? ???. ?? ??? ???? ??? ????? ?????. ??? ?????? ??, ??(????? ?? ??) ? ??? ??? ? ????. ????? ?????? ??? ??(???? ??)?? ?????? ??? ??(??? ??)?? ?????? ??? ?? ? ???(?? ? ???? ??)???.
??? ????? - ??? ??? ?? ??(???)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 200px; width: 200px; background: -webkit-radial-gradient(red, yellow, blue); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(red, yellow, blue); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(red, yellow, blue); /* Firefox 3.6 - 15 */ background: radial-gradient(red, yellow, blue); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <div id="grad1"></div> </body> </html>
??? ????? - ??? ?? ??? ?? ??
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> #grad1 { height: 200px; width: 200px; background: -webkit-radial-gradient(red 9%, yellow 19%, blue 60%); /* Safari 9.1 - 6.0 */ background: -o-radial-gradient(red 9%, yellow 19%, blue 60%); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(red 9%, yellow 19%, blue 60%); /* Firefox 3.6 - 19 */ background: radial-gradient(red 9%, yellow 19%, blue 60%); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <div id="grad1"></div> </body> </html>
??? ?? ??? ??
?? ????? ?????? ??? ?????. ?? ? ?? ?? ? ????:
?? ??? ?
?? ? ?
?? ??? ?
?? ? ?
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> #grad1 { height: 200px; width: 200px; background: -webkit-radial-gradient(60% 55%, closest-side,pink,green,yellow,#0ff); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(60% 55%, closest-side,pink,green,yellow,#0ff); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(60% 55%, closest-side,pink,green,yellow,#0ff); /* Firefox 3.6 - 15 */ background: radial-gradient(60% 55%, closest-side,pink,green,yellow,#0ff); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad2 { height: 200px; width: 200px; background: -webkit-radial-gradient(60% 55%, farthest-side,pink,green,yellow,#0ff); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(60% 55%, farthest-side,pink,green,yellow,#0ff); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(60% 55%, farthest-side,pink,green,yellow,#0ff); /* Firefox 3.6 - 15 */ background: radial-gradient(60% 55%, farthest-side,pink,green,yellow,#0ff); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad3 { height: 200px; width: 200px; background: -webkit-radial-gradient(60% 55%, closest-corner,pink,green,yellow,#0ff); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(60% 55%, closest-corner,pink,green,yellow,#0ff); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(60% 55%, closest-corner,pink,green,yellow,#0ff); /* Firefox 3.6 - 15 */ background: radial-gradient(60% 55%, closest-corner,pink,green,yellow,#0ff); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } #grad4 { height: 200px; width: 200px; background: -webkit-radial-gradient(60% 55%, farthest-corner,pink,green,yellow,#0ff); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(60% 55%, farthest-corner,pink,green,yellow,#0ff); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(60% 55%, farthest-corner,pink,green,yellow,#0ff); /* Firefox 3.6 - 15 */ background: radial-gradient(60% 55%, farthest-corner,pink,green,yellow,#0ff); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <p><strong>closest-side:</strong></p> <div id="grad1"></div> <p><strong>farthest-side:</strong></p> <div id="grad2"></div> <p><strong>closest-corner:</strong></p> <div id="grad3"></div> <p><strong>farthest-corner(默認(rèn)):</strong></p> <div id="grad4"></div> </body> </html>
?? ??? ?????
repeating-radial-gradient() ??? ???? ??? ?????? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> #grad1 { height: 300px; width: 280px; background: -webkit-repeating-radial-gradient(red, yellow 10%, blue 15%); /* Safari 5.1 - 6.0 */ background: -o-repeating-radial-gradient(red, yellow 10%, blue 15%); /* Opera 11.6 - 12.0 */ background: -moz-repeating-radial-gradient(red, yellow 10%, blue 15%); /* Firefox 3.6 - 15 */ background: repeating-radial-gradient(red, yellow 10%, blue 15%); /* 標(biāo)準(zhǔn)的語(yǔ)法(必須放在最后) */ } </style> </head> <body> <div id="grad1"></div> </body> </html>