{"id":734,"date":"2010-04-08T20:14:05","date_gmt":"2010-04-08T12:14:05","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=734"},"modified":"2018-01-01T15:39:43","modified_gmt":"2018-01-01T07:39:43","slug":"css-gradient%e6%b8%90%e5%8f%98%e4%b9%8bwebkit%e6%a0%b8%e5%bf%83%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%8b%e7%9a%84%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2010\/04\/css-gradient%e6%b8%90%e5%8f%98%e4%b9%8bwebkit%e6%a0%b8%e5%bf%83%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%8b%e7%9a%84%e4%bd%bf%e7%94%a8\/","title":{"rendered":"CSS gradient\u6e10\u53d8\u4e4bwebkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b\u7684\u4f7f\u7528"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=734\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=734<\/a><\/p>\n<h3>\u4e00\u3001\u5173\u4e8e\u6e10\u53d8<\/h3>\n<p>\u6e10\u53d8\u662f\u4e00\u79cd\u5e94\u7528\u4e8e\u5e73\u9762\u7684\u89c6\u89c9\u6548\u679c\uff0c\u53ef\u4ee5\u4ece\u4e00\u79cd\u989c\u8272\u9010\u6e10\u5730\u8f6c\u53d8\u6210\u53e6\u5916\u4e00\u79cd\u989c\u8272\uff0c\u6545\u53ef\u4ee5\u521b\u5efa\u7c7b\u4f3c\u4e8e\u5f69\u8679\u7684\u6548\u679c\u6e10\u53d8\u53ef\u4ee5\u5e94\u7528\u5728\u4efb\u4f55\u53ef\u4ee5\u4f7f\u7528\u56fe\u7247\u7684\u5730\u65b9\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u8fd9\u4e48\u4e00\u4e2a\u6e10\u53d8\uff1a\u9876\u90e8\u7684\u989c\u8272\u662f\u7ea2\u8272\uff0c\u4e2d\u95f4\u7684\u662f\u84dd\u8272\uff0c\u5e95\u90e8\u4e3a\u9ec4\u8272\u6765\u4f5c\u4e3adiv\u7684\u80cc\u666f\u8272\u3002\u6e10\u53d8\u901a\u8fc7<a target=\"_top\" href=\"http:\/\/developer.apple.com\/safari\/library\/documentation\/AppleApplications\/Reference\/SafariCSSRef\/Articles\/Functions.html#\/\/apple_ref\/css\/func\/-webkit-gradient\">-webkit-gradient<\/a>\u65b9\u6cd5\u5b9e\u73b0\uff0c\u53ef\u4ee5\u7528\u6765\u4ee3\u66ff\u56fe\u7247URL\u3002\u5728webkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b(Safari4+, Chrome)\uff0c\u6709\u4e24\u79cd\u7c7b\u578b\u7684\u6e10\u53d8\uff0c\u7ebf\u6027\u7684\u548c\u5f84\u5411\u7684\u3002\u60a8\u8fd8\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u4e2d\u95f4\u8fc7\u6e21\u8272\uff0c\u6b64\u79f0\u4e4b\u4e3a<strong><em>color stops.<\/em><\/strong><\/p>\n<h3>\u4e8c\u3001\u57fa\u672c\u8bed\u6cd5<\/h3>\n<p>webkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b\u7684\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>-webkit-gradient(type, start_point, end_point, \/ stop...)\n-webkit-gradient(type, inner_center, inner_radius, outer_center, outer_radius, \/ stop...)<\/pre>\n<\/div>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<table width=\"100%%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<tr>\n<th scope=\"col\">\u53c2\u6570\u7c7b\u578b<\/th>\n<th scope=\"col\">\u7b80\u8981\u8bf4\u660e<\/th>\n<\/tr>\n<tr>\n<td>type<\/td>\n<td>\u6e10\u53d8\u7684\u7c7b\u578b\uff0c\u53ef\u4ee5\u662f\u7ebf\u6027\u6e10\u53d8(linear)\u6216\u662f\u5f84\u5411\u6e10\u53d8(radial)<\/td>\n<\/tr>\n<tr>\n<td>start_point<\/td>\n<td>\u6e10\u53d8\u56fe\u50cf\u4e2d\u6e10\u53d8\u7684\u8d77\u59cb\u70b9<\/td>\n<\/tr>\n<tr>\n<td>end_point<\/td>\n<td>\u6e10\u53d8\u56fe\u50cf\u4e2d\u6e10\u53d8\u7684\u7ed3\u675f\u70b9<\/td>\n<\/tr>\n<tr>\n<td>stop<\/td>\n<td>color-stop()\u65b9\u6cd5\uff0c\u6307\u5b9a\u6e10\u53d8\u8fdb\u7a0b\u4e2d\u7279\u5b9a\u7684\u989c\u8272<\/td>\n<\/tr>\n<tr>\n<td>inner_center<\/td>\n<td>\u5185\u90e8\u4e2d\u5fc3\u70b9\uff0c\u5f84\u5411\u6e10\u53d8\u8d77\u59cb\u5706\u73af<\/td>\n<\/tr>\n<tr>\n<td>inner_radius<\/td>\n<td>\u5185\u90e8\u534a\u5f84\uff0c\u5f84\u5411\u6e10\u53d8\u8d77\u59cb\u5706<\/td>\n<\/tr>\n<tr>\n<td>outer_center<\/td>\n<td>\u5916\u90e8\u6e10\u53d8\u7ed3\u675f\u5706\u7684\u4e2d\u5fc3\u70b9<\/td>\n<\/tr>\n<tr>\n<td>outer_radius<\/td>\n<td>\u5916\u90e8\u6e10\u53d8\u7ed3\u675f\u5706\u7684\u534a\u5f84<\/td>\n<\/tr>\n<\/table>\n<p><strong>\u5173\u4e8e\u53c2\u6570\u7684\u5177\u4f53\u8bf4\u660e<\/strong><\/p>\n<p>1. start_point\u548cend_point<br \/>\u5982\u679c\u60a8\u5bf9photoshop\u6216\u662fflash\u4e4b\u7c7b\u7684\u8bbe\u8ba1\u8f6f\u4ef6\u7684\u6e10\u53d8\u529f\u80fd\u719f\u6089\uff0c\u90a3\u4e48\u7406\u89e3\u6e10\u53d8\u7684\u4e00\u4e9b\u6982\u5ff5\u6216\u662f\u53c2\u6570\u76f8\u5bf9\u5c31\u5bb9\u6613\u4e9b\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u518dphotoshop\u4e2d\u5212\u4e00\u6761\u6e10\u53d8\u7ebf\uff0c\u4f1a\u6709\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\uff0c\u8fd9\u4e2a\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\u5c31\u5bf9\u5e94\u8fd9\u91cc\u7684start_point\u548cend_point\u53c2\u6570\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-07_222226.png\" width=\"536\" height=\"210\" title=\"photoshop\u6e10\u53d8\u7684\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"photoshop\u6e10\u53d8\u7684\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/p>\n<p>start_point(x1,x2)\uff0cend_point(x2,y2)\uff0c\u8fd9\u91cc\u7684x,y\u5bf9\u5e94\u5de6\u4e0a\u89d2\u4e3a\u8d77\u70b9\u7684\u5750\u6807\uff0c\u6b64\u5904\u7684x,y\u53c2\u6570\u8868\u793a\u4e0eCSS\u4e2d\u7684background-position\u662f\u4e00\u81f4\u7684\uff0c\u53ef\u4ee5\u4f7f\u50cf\u7d20\u503c\uff0c\u6216\u662f\u767e\u5206\u6bd4\u503c\u6216\u662fleft,top,right,bottom\u3002<br \/>\u5f53x1\u7b49\u4e8ex2\uff0cy1\u4e0d\u7b49\u4e8ey2\uff0c\u5b9e\u73b0\u5782\u76f4\u6e10\u53d8\uff0c\u8c03\u6574y1\uff0cy2\u7684\u503c\u53ef\u4ee5\u8c03\u6574\u6e10\u53d8\u534a\u5f84\u5927\u5c0f\uff1b<br \/>\u5f53y1\u7b49\u4e8ey2\uff0cx1\u4e0d\u7b49\u4e8ex2\uff0c\u5b9e\u73b0\u6c34\u5e73\u6e10\u53d8\uff0c\u8c03\u6574x1\uff0cx2\u7684\u503c\u53ef\u4ee5\u8c03\u6574\u6e10\u53d8\u534a\u5f84\u5927\u5c0f\uff1b<br \/>\u5f53y1\u4e0d\u7b49\u4e8ey2\uff0cx1\u4e0d\u7b49\u4e8ex2\uff0c\u5b9e\u73b0\u89d2\u5ea6\u6e10\u53d8\uff0c\u5f53x1,x2,y1,y2\u53d6\u503c\u4e3a\u6781\u503c\u7684\u65f6\u5019\u63a5\u8fd1\u5782\u76f4\u6e10\u53d8\u6216\u6c34\u5e73\u6e10\u53d8\uff1b<br \/>\u5f53x1\u7b49\u4e8ex2\uff0cy1\u7b49\u4e8ey2\uff0c\u5b9e\u73b0\u6ca1\u6709\u6e10\u53d8\uff0c\u53d6from\u8272\uff0c\u5373\u201c from(\u989c\u8272\u503c) \u201d\uff1b<\/p>\n<p>2. stop<br \/>color-stop()\u6211\u7684\u7406\u89e3\u5c31\u662f\u8fc7\u6e21\u70b9\uff0c\u8fd9\u4e9b\u8fc7\u6e21\u70b9\u6709\u4e24\u4e2a\u53c2\u6570\uff0c\u4e00\u4e2a\u662f\u70b9\u7684\u4f4d\u7f6e\uff0c\u53e6\u5916\u4e00\u4e2a\u662f\u8fc7\u6e21\u70b9\u7684\u989c\u8272\u3002\u8fd9\u4e9b\u53c2\u6570\u7684\u793a\u610f\u4e5f\u53ef\u4ee5\u5728photoshop\u4e4b\u7c7b\u7684\u8f6f\u4ef6\u6e10\u53d8\u7f16\u8f91\u5668\u4e2d\u627e\u5230\u5bf9\u5e94\u7684\u4f4d\u7f6e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgpad\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-07_224727.png\" width=\"434\" height=\"244\" title=\"photoshop\u6e10\u53d8\u7684\u4e2d\u95f4\u8fc7\u6e21\u70b9 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"photoshop\u6e10\u53d8\u7684\u4e2d\u95f4\u8fc7\u6e21\u70b9 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/p>\n<p>\u6211\u4eec\u4f1a\u89c1\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u4ee3\u7801\u7247\u6bb5\uff0c<code>color-stop(0.5, #ff0000)<\/code>\u6240\u8868\u793a\u7684\u610f\u601d\u662f\u5728\u6e10\u53d8\u8fc7\u6e21\u8fdb\u7a0b\u7684\u4e2d\u5fc3\u4f4d\u7f6e(50%\u7684\u4f4d\u7f6e)\u6709\u4e2a\u989c\u8272\u4e3a#ff0000\uff08\u7ea2\u8272\uff09\u7684\u8fc7\u6e21\u8272\u3002<\/p>\n<h3>\u4e09\u3001\u521b\u5efa\u7ebf\u6027\u6e10\u53d8<\/h3>\n<p>\u8fd9\u91cc\u5c55\u793a\u7684\u662f\u6700\u7b80\u5355\u7684\u7ebf\u6027\u6e10\u53d8\uff0c\u7531\u84dd\u8272\u81f3\u767d\u8272\u7684\u6e10\u53d8\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>\n.linear{width:130px; height:130px; border:1px solid green; padding:10px; background:-webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff)); -webkit-background-origin:padding; -webkit-background-clip:content;}\n\n&lt;div class=\"linear\">&lt;\/div>\n<\/pre>\n<\/div>\n<p>\u53c2\u89c1\u4e0a\u9762\u7684background\u5c5e\u6027\u503c\uff0c\u53ef\u4ee5\u5f97\u5230webkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b\u7ebf\u6027\u6e10\u53d8\u7684\u57fa\u672c\u8bed\u6cd5\uff0c\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>-webkit-gradient(type,x1 y1, x2 y2, from(\u5f00\u59cb\u989c\u8272\u503c), [color-stop(\u4f4d\u7f6e\u504f\u79fb-\u5c0f\u6570,\u505c\u9760\u989c\u8272\u503c),...],to(\u7ed3\u675f\u989c\u8272\u503c));<\/pre>\n<\/div>\n<p>\u4e0a\u9762\u793a\u4f8b\u4ee3\u7801\u5b9e\u73b0\u7684\u6548\u679c\u5982\u4e0b\u622a\u56fe\uff1a<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-07_234521.png\" width=\"162\" height=\"163\" title=\"Safari\u6d4f\u89c8\u5668\u4e0b\u7b80\u5355\u7684\u7ebf\u6027\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"Safari\u6d4f\u89c8\u5668\u4e0b\u7b80\u5355\u7684\u7ebf\u6027\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/div>\n<h3>\u56db\u3001\u521b\u5efa\u5f84\u5411\u6e10\u53d8<\/h3>\n<p>\u5f84\u5411\u6e10\u53d8\u4e5f\u53ef\u4ee5\u79f0\u4e3a\u653e\u5c04\u72b6\u6e10\u53d8\uff0c\u5e38\u7528\u6765\u5f62\u6210\u73af\u72b6\u6548\u679c\uff0c\u6655\u72b6\u6548\u679c\u7b49\u3002\u5982\u4e0b\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>\n.radial{\n    display:block; \n    width:150px; \n    height:150px; \n    border:1px solid blue; \n    background-image:-webkit-gradient(radial, 45 45, 10, 52 50, 30, from(#A7D30C), to(rgba(1,159,98,0)), color-stop(90%, #019F62)), \n        -webkit-gradient(radial, 105 105, 20, 112 120, 50, from(#ff5f98), to(rgba(255,1,136,0)), color-stop(75%, #ff0188)), \n        -webkit-gradient(radial, 95 15, 15, 102 20, 40, from(#00c9ff), to(rgba(0,201,255,0)), color-stop(80%, #00b5e2)), \n        -webkit-gradient(radial, 0 150, 50, 0 140, 90, from(#f4f201), to(rgba(228, 199,0,0)), color-stop(80%, #e4c700));\n}\n\n&lt;div class=\"radial\">&lt;\/div>\n<\/pre>\n<\/div>\n<p>\u7ed3\u679c\u5982\u4e0b\u56fe\uff0c\u622a\u81eaSafari\u6d4f\u89c8\u5668\uff1a<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-08_000449.png\" width=\"165\" height=\"165\" title=\"Safari\u6d4f\u89c8\u5668\u4e0b\u7684\u5f84\u5411\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"Safari\u6d4f\u89c8\u5668\u4e0b\u7684\u5f84\u5411\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/div>\n<h3>\u4e94\u3001\u6307\u5b9a\u8fc7\u6e21\u989c\u8272\u70b9<\/h3>\n<p>\u5373\u4f7f\u7528<a target=\"_top\" href=\"..\/..\/..\/..\/AppleApplications\/Reference\/SafariCSSRef\/Articles\/Functions.html#\/\/apple_ref\/css\/func\/color-stop\">color-stop<\/a>\u65b9\u6cd5\u521b\u5efa\u8272\u6807\u70b9\u3002\u542b\u6709\u4e24\u4e2a\u53c2\u6570\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u8868\u793a\u6e10\u53d8\u70b9\u7684\u5728\u6574\u4e2a\u6e10\u53d8\u8303\u56f4\u5185\u7684\u4f4d\u7f6e\uff0c\u4ee5\u5c0f\u6570\u8868\u793a\uff1b\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a\u989c\u8272\uff0c\u53ef\u4ee5\u4f7f\u7528RGBA\u7684\u5f62\u5f0f\u8868\u793a\uff0c\u8fd9\u6837\u53ef\u4ee5\u6307\u5b9a\u989c\u8272\u7684\u900f\u660e\u5ea6\u3002<\/p>\n<p>\u4f7f\u7528<a target=\"_top\" href=\"..\/..\/..\/..\/AppleApplications\/Reference\/SafariCSSRef\/Articles\/Functions.html#\/\/apple_ref\/css\/func\/color-stop\">color-stop<\/a>\u6307\u5b9a\u8fc7\u6e21\u70b9\u6216\u79f0\u4e3a\u8272\u6807\u70b9\u65f6\uff0c\u6e10\u53d8\u7684\u5f00\u59cb(from())\u4ee5\u53ca\u7ed3\u675f(to())\u989c\u8272\u90fd\u662f\u53ef\u4ee5\u7701\u7565\u7684\u3002\u60a8\u53ef\u4ee5\u53c2\u89c1\u4e0b\u9762\u7684\u5b9e\u4f8b\uff0c\u7b2c\u4e00\u4e2a\u6709from()\u4ee5\u53caend()\u7684\u6e10\u53d8\uff0c\u7b2c\u4e8c\u4e2a\u6ca1\u6709from()\u4ee5\u53castop()\u3002<\/p>\n<p>1. \u4f7f\u7528from()\u4ee5\u53cato()\u65b9\u6cd5<\/p>\n<div class=\"zxx_code\">\n<pre>\nbody {\n   background: -webkit-gradient(linear, left top, left bottom, from(#ff0), color-stop(0.5, orange), to(rgb(255, 0, 0)));\n}\n<\/pre>\n<\/div>\n<p>\u4e0a\u9762\u4ee3\u7801\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-08_080847.png\" width=\"501\" height=\"198\" title=\"\u4f7f\u7528from()\u4ee5\u53cato()\u65b9\u6cd5\u7684\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"\u4f7f\u7528from()\u4ee5\u53cato()\u65b9\u6cd5\u7684\u6e10\u53d8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/div>\n<p>2. \u4e0d\u6307\u5b9a\u8d77\u59cb\u989c\u8272\u4e0e\u7ed3\u675f\u989c\u8272<\/p>\n<div class=\"zxx_code\">\n<pre>background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0.40, #ff0), color-stop(0.5, orange), color-stop(0.60, rgb(255, 0, 0)));<\/pre>\n<\/div>\n<p>\u7ed3\u679c\u5982\u4e0b\uff0c\u622a\u81eaSafari 4\u6d4f\u89c8\u5668\uff1a<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-08_192002.png\" width=\"414\" height=\"163\" title=\"\u4e0d\u6307\u5b9a\u8d77\u59cb\u989c\u8272\u4e0e\u7ed3\u675f\u989c\u8272\u5b9e\u73b0\u6e10\u53d8\u6548\u679c \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"\u4e0d\u6307\u5b9a\u8d77\u59cb\u989c\u8272\u4e0e\u7ed3\u675f\u989c\u8272\u5b9e\u73b0\u6e10\u53d8\u6548\u679c \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/div>\n<p>3. \u591a\u4e2a\u8fc7\u6e21\u70b9\u5728\u540c\u4e00\u4f4d\u7f6e<\/p>\n<div class=\"zxx_code\">\n<pre>width:200px; height:120px; background:-webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff), color-stop(0.5, #fff), color-stop(0.5, #66cc00));<\/pre>\n<\/div>\n<p>\u7ed3\u679c\u7c7b\u4f3c\u4e0b\u9762\u622a\u56fe\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-08_193006.png\" width=\"209\" height=\"132\" title=\"\u8fc7\u6e21\u70b9\u4f4d\u7f6e\u4e00\u81f4\u7684\u6e10\u53d8\u8868\u73b0 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"\u8fc7\u6e21\u70b9\u4f4d\u7f6e\u4e00\u81f4\u7684\u6e10\u53d8\u8868\u73b0 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/pre>\n<\/div>\n<h3>\u516d\u3001\u521b\u5efa\u80cc\u666f\u91cd\u590d\u6e10\u53d8<\/h3>\n<p>CSS3\u4e2d\u6709\u4e2abackground-size\u5c5e\u6027\uff0c\u53ef\u4ee5\u6539\u53d8\u80cc\u666f\u56fe\u7247\u7684\u5927\u5c0f\uff0c\u914d\u5408\u80cc\u666f\u6e10\u53d8\u5c5e\u6027\u53ef\u4ee5\u5b9e\u73b0\u91cd\u590d\u7684\u80cc\u666f\u6e10\u53d8\uff0c\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>width:400px; height:150px; background:-webkit-gradient(linear, left top, left bottom, from(#ff0000), to(#ffff00)); -webkit-background-size:0 20px;<\/pre>\n<\/div>\n<p>\u7ed3\u679c\u5982\u4e0b\u56fe\uff1a<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201004\/2010-04-08_195732.png\" width=\"408\" height=\"158\" title=\"\u80cc\u666f\u6e10\u53d8\u91cd\u590d\u6548\u679c \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" alt=\"\u80cc\u666f\u6e10\u53d8\u91cd\u590d\u6548\u679c \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" \/><\/div>\n<p><strong>\u53c2\u8003\u6587\u7ae0<\/strong><br \/>\n1. <a href=\"http:\/\/developer.apple.com\/safari\/library\/documentation\/InternetWeb\/Conceptual\/SafariVisualEffectsProgGuide\/Gradients\/Gradients.html#\/\/apple_ref\/doc\/uid\/TP40008032-CH7-SW1\">Safari CSS Visual Effects Guide<\/a><br \/>\n2. <a href=\"http:\/\/www.css88.com\/archives\/tag\/webkit-gradient\">webkit \u5185\u6838\u6d4f\u89c8\u5668\u7684Linear Gradients (\u7ebf\u6027\u6e10\u53d8)<\/a><br \/>\n3. <a href=\"http:\/\/developer.apple.com\/safari\/library\/documentation\/AppleApplications\/Reference\/SafariCSSRef\/Articles\/Functions.html#\/\/apple_ref\/css\/func\/-webkit-gradient\">CSS Property Functions<\/a><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"http:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=734\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=734<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6e10\u53d8\u662f\u4e00\u79cd\u5e94\u7528\u4e8e\u5e73\u9762\u7684\u89c6\u89c9\u6548\u679c\uff0c\u53ef\u4ee5\u4ece\u4e00\u79cd\u989c\u8272\u9010\u6e10\u5730\u8f6c\u53d8\u6210\u53e6\u5916\u4e00\u79cd\u989c\u8272\uff0c\u6545\u53ef\u4ee5\u521b\u5efa\u7c7b\u4f3c\u4e8e\u5f69\u8679\u7684\u6548\u679c\u6e10\u53d8\u53ef\u4ee5\u5e94\u7528\u5728\u4efb\u4f55\u53ef\u4ee5\u4f7f\u7528\u56fe\u7247\u7684\u5730\u65b9\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u8fd9\u4e48\u4e00\u4e2a\u6e10\u53d8\uff1a\u9876\u90e8\u7684\u989c\u8272\u662f\u7ea2\u8272\uff0c\u4e2d\u95f4\u7684\u662f\u84dd\u8272\uff0c\u5e95\u90e8\u4e3a\u9ec4\u8272\u6765\u4f5c\u4e3adiv\u7684\u80cc\u666f\u8272\u3002\u6e10\u53d8\u901a\u8fc7-webkit-gradient\u65b9\u6cd5\u5b9e\u73b0\uff0c\u53ef\u4ee5\u7528\u6765\u4ee3\u66ff\u56fe\u7247URL\u3002\u5728webkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b(Safari4+, Chrome)\uff0c\u6709\u4e24\u79cd\u7c7b\u578b\u7684\u6e10\u53d8\uff0c\u7ebf\u6027\u7684\u548c\u5f84\u5411\u7684\u3002\u60a8\u8fd8\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u4e2d\u95f4\u8fc7\u6e21\u8272\uff0c\u6b64\u79f0\u4e4b\u4e3acolor stops\u3002<br \/>\n\u672c\u6587\u8db3\u591f\u8be6\u5c3d\u5730\u8bb2\u89e3\u4e86webkit\u6838\u5fc3\u6d4f\u89c8\u5668\u4e0b\u7684gradient\u6e10\u53d8\u7684\u4f7f\u7528\uff0c\u63d0\u4f9b\u4ee3\u7801\u793a\u4f8b\u548c\u622a\u56fe\u793a\u4f8b\uff0c\u5e0c\u671b\u80fd\u5bf9\u60a8\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[163,136,363,177,1271,138,290,189],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/734"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=734"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/734\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}