ã¯ãã¹ãã©ã¦ã¶ãª css3 linear-gradient ãé¢åã«ãªããããªä»¶ã«ã¤ãã¦
2012 å¹´ã® 4æã« CR(å§ååè£) ã«ãªã£ãï¼CSS Image Values and Replaced Content Module Level 3 ã¨ããã§è¦å®ããã¦ãï¼Linear Gradients: the ‘linear-gradient()’ notation ã®å¹¾ã¤ãã®ãã©ã¦ã¶ã§ã®å¯¾å¿å ·åãé¢åãªäºã«ãªã£ã¦ããªãã£ã¦ã話ï¼
çµç·¯ã¨ã
æåæ
ãã¨ãã¨ï¼ã°ã©ãã¼ã·ã§ã³ã ã¼ã¨ææ¡ãããé ã«ã¯ï¼WebKit ã®ç¬èªå®è£ ã¨ãã¦ãããªæãã®æ¸å¼ã ã£ãï¼(cf. Introducing CSS Gradients)
background: -webkit-gradient(linear, left top /* å§ç¹ */, left bottom /* çµç¹ */, from(#000) /* å§ç¹ã®è² */, to(#FFF) /* çµç¹ã®è² */);
éä¸ã«ãã£ã¨è²ãæãã¨ãéæ度ãå¤åãããã¨ãç´°ããæå®ã¯å²æï¼
ããã«å¯¾ã㦠Gecko(Mozilla) ãææ¡ãã¦ããã®ãï¼ä»¥ä¸ã®æ§ãªã¡ãã£ã¨éãæ¸å¼ã ã£ãï¼
background: -moz-linear-gradient( top /* å§ç¹ */, #000 /* å§ç¹ã®è² */, #FFF /* çµç¹ã®è² */);
ãã®ãããã¯MDNã® linear-gradient #History of_the syntax ãåç §ï¼
æ··è¿·æ
å½ç¶ã¨ããã°å½ç¶ã ãï¼å½åããå¥ã®æ¸å¼ãææ¡ããã¦ããããã«ï¼2010å¹´é ã«ã¯2ã¤ã®ãç¬èªå®è£ ã«å¯¾å¿ãããã«ã¯ããæ¸ãã¨ãã£ãè¨äºãï¼Gradient generator ãªã©ã¨å¼ã°ããåå®è£ ç¨ã®ã³ã¼ãããæ軽ã«çæãããããªãµã¼ãã¹ãè·³æ¢è·æããéã³ã¨ãªã£ã¦ããï¼
ããã§ï¼ããã« IE ç¨ã« filter ã使ã£ããï¼Opera ç¨ã« SVG ã使ã£ããã¨è¨ã£ãï¼ãããã working draft ã§ããã¨ãï¼vendor-prefix ä»ãã§ããã¨ããããã¨ã®æå³ãç¡è¦ãããã®ãã㪠how to ã主張ãè¦ããããï¼æºãè¿ãçã« vendor-prefix åèã¨ãã£ãåãã«ã¤ãªãã£ãããã¦ããã©ï¼ãã®ã¸ãã¯ã¾ãå¥ã®ã話ï¼
background: #000000; /* Old browsers */ /* IE9 SVG, needs conditional override of 'filter' to 'none' */ background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: -moz-linear-gradient(top, #000000 0%, #ffffff 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000000), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */ background: linear-gradient(top, #000000 0%, #ffffff 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#ffffff',GradientType=0 ); /* IE6-8 */
Ultimate CSS Gradient Generatorã§ã®çæãã調æ´ï¼
ããã«ããã« CSS å¤ï¼IE ã®ã³ã³ãã£ã·ã§ãã«ã³ã¡ã³ãã navigator.userAgent ãªã©ã®ãã©ã¦ã¶å¤å®ãªã©)ã¨ãããããªçµã¿åããã¦ä½ã¨ããã¦ãï¼
å®å®æ
ã§ï¼2011å¹´ã«å ¥ã£ã¦ï¼ã¾ãï¼WebKit ã -moz-linear-gradient ã¨åãæ¸å¼ã«å¯¾å¿ï¼4æã«ã¯Opera ã 11.10(Presto/2.8.119) 㧠-o-linear-gradient() ã¨ãã¦å¯¾å¿ï¼5æã«ã¯IE10pp1 㧠-ms-linear-gradietn() ã¨ãã¦å¯¾å¿ ã¨ãªã£ã¦ï¼vendor-prefix ä»ããå¿ è¦ã¯ãããã©ï¼ã»ã¼åãæ¸å¼ã«çµ±ä¸ããã¦ï¼linear-gradient ã使ããããã«ãªã£ãï¼
ãã®é ã«ãªãã¨ï¼å¤ããã©ã¦ã¶ã¯ã¨ããããç½®ãã¨ãã¦åºã使ããããã«ãªã£ã¦ãããã¨ãï¼open web ããï¼CSS ãã¬ã¼ã ã¯ã¼ã¯ã®æ®åããã§ï¼ä»¥ä¸ã®æ§ãªæ¸ãæ¹ããããããã«ãªãä¸å¿ã®åæãè¦ãï¼
background: -webkit-linear-gradient(top, #000, #fff); background: -moz-linear-gradient(top, #000, #fff); background: -o-linear-gradient(top, #000, #fff); background: -ms-linear-gradient(top, #000, #fff); /* for ie10 platform preview */ background: linear-gradient(top, #000, #fff);
ã¨ãããï¼ããã§ï¼å¤§å ã® CSS3 ã®ä»æ§ã«ç ´å£çãªå¤æ´ãå ¥ãåã³æ··ä¹±æã«çªå ¥ã¨ãªãï¼
åæ··ä¹±æï¼
20110712çã®WDã§ã®å¤æ´ãå§ã¾ãã§ããï¼
linear-gradient ã§ã¯æ¹åã®æå®ã« top/bottom/left/right
ã¨ãã£ããã¼ã¯ã¼ãã®ä»ã«ï¼è§åº¦(deg) ã§ã®æå®ãã§ããï¼
20110712 çã¾ã§ã¯ï¼ä¸ãé»ã§ä¸ãç½ã®ã°ã©ãã¼ã·ã§ã³ã®å ´åï¼(top, #000, #fff)
ã¨æ¸ããï¼(-90deg,#000,#fff)
ã¨æ¸ãã¦ããï¼è§åº¦ã®æ°å¤ã¯ï¼X軸æ£ã®æ¹åã0ï¼Y軸æ£ã®æ¹åã90ã¨ãï¼åæè¨åãã«å¢å ããæ°å¦çãªè±¡éã¨åæ§ã ã£ãï¼
ãããï¼20110712 ç以éã§ã¯ï¼Y軸æ£ã®æ¹åã0ï¼X軸æ£ã®æ¹åã90ã¨ãï¼æè¨åãã«å¢å ãã座æ¨ç³»ãæ¡ç¨ããï¼ããã¾ã§ã¨åæ§ã®å¹æãå¾ãã«ã¯ï¼(180deg,#000,#fff)
ã¨æ¸ãããã«å¤æ´ãããï¼
ããã¯ä»ã® CSS ã®ä»æ§ã SVG ã®ä»æ§ã¨ã®çµ±ä¸æ§ã®è¦³ç¹ããè°è«ã¨ãªãå¤æ´ã¨ãªã£ãï¼åç § CSSã°ã©ãã¼ã·ã§ã³ã§ã®è§åº¦ã®è§£é ï¼ï¼
20120712 çã§ã®å¤æ´ãè¸ã¾ãã¦ï¼æ¬¡ã®20110908çã®WDã§ï¼ãã¼ã¯ã¼ã to
ã追å ããï¼ããã¾ã§ã® top
㯠to bottom
ã¸ï¼left
㯠to right
ã¸ã¨å¤æ´ã«ãªã£ãï¼åç
§ CSSã°ã©ãã¼ã·ã§ã³ã®æ§æå¤æ´ã¨ãã³ãã¼æ¥é è¾ï¼ï¼
ãã®ä»æ§å¤æ´ã«è¿½éããã®ãï¼Mozilla 㨠Opera ã ã£ãï¼
ã¾ãï¼Mozilla 㯠685400 - Add a new syntax to -moz-linear-gradient per latest css spec ã«ã¦ï¼to
æãã¨ç¡ã両æ¹ã®è¨è¿°ã«å¯¾å¿ãããã¨ã«ãªã£ãï¼
Opera 㯠11.60 ããããããã¯ãï¼æãç¡ã両æ¹ã®è¨è¿°ã«å¯¾å¿ãããã¨ã«ãªã£ãï¼(CSS3 Image Values/Replaced Content support in Opera Presto 2.9#linear-gradient(); 11.5x ã Presto 2.9.x ãªã®ã§å¯¾å¿ãã¦ããããã«èªããã Desktop ç 11.52 ã§ã¯ to ç¡ãã®ã¿å¯¾å¿ )
ãã ãï¼Mozilla ã Opera ã vedor-prefix ãã¤ãã¦ãããã¡ã¯ï¼20110712 çã§ã®è§åº¦ã§ã®å¤æ´ã«ã¯å¯¾å¿ããï¼å¾æ¥éãã®åæè¨åããæ£ã¨ããæå®ã®ã¾ã¾ã¨ãªã£ã¦ããï¼
ã¤ã¾ãï¼å¤ããã©ã¦ã¶ãããç¨åº¦æ¨ã¦ãã¨ãã¦ãï¼ä»æ§ã¨åãã©ã¦ã¶ã®å®è£ ã¨ã®æãåããã¤ããã¨ä»¥ä¸ã®æ§ã«æ¸ããã¨ã«ãªãï¼
background: -webkit-linear-gradient(top, #000, #fff); background: -moz-linear-gradient(top, #000, #fff); /* -moz-liner-gradient(to bottom, #000, #fff); */ background: -o-linear-gradient(top, #000, #fff); /* -o-liner-gradient(to bottom, #000, #fff); */ background: -ms-linear-gradient(top, #000, #fff); /* for ie10 platform preview */ background: linear-gradient(to bottom, #000, #fff);
è§åº¦ã§ã®æå®ã§ã¯ä»¥ä¸ã®æ§ã«ãªãï¼
background: -webkit-linear-gradient(-90deg, #000, #fff); background: -moz-linear-gradient(-90deg, #000, #fff); /* -moz-liner-gradient(180deg, #000, #fff); */ background: -o-linear-gradient(-90deg, #000, #fff); /* -o-liner-gradient(180deg, #000, #fff); */ background: -ms-linear-gradient(-90deg, #000, #fff); /* for ie10 platform preview */ background: linear-gradient(180deg, #000, #fff);
ããã¾ã§ãï¼2012 å¹´8æç¾å¨ã®ç¶æ³ã§ããï¼
2012 å¹´ã®ç§å¬ã«å¾ ã¡åããäºæ
ãã¦ï¼åé¡ã¯ããããã®è©±ãã«ããï¼åæ··ä¹±æã§ååã«é¢åãªé°å²æ°ã«ã¯ãªãã¤ã¤ãããï¼2012å¹´ã®ç§ãå¬ã«ã¯å°ãªãã¨ã 2ã¤å¤åããã£ã¦ããï¼
IE10 ã®ãªãªã¼ã¹ã¨ Opera 12.50 ã®ãªãªã¼ã¹ã§ããï¼
IE10 ã§ã® linear-gradient
Windows 8 Release Preview ã«æè¼ããã IE10 ã§ã¯ï¼to
ãã¼ã¯ã¼ãããã®ã¿ã«å¯¾å¿ãï¼è§åº¦ã®æå®ã¯ CR ã§ãã 20120412çã«å¯¾å¿ããï¼ãªãã㤠-ms- ã® vendor-prefix ãæããªãï¼Unprefixed CSS3 Gradients in IE10.
ãããã£ã¦ï¼-ms-linear-gradient ã®ä»ãããã®ãåç´ã«åé¤ãã¦ï¼IE10 ç¨ã¯ï¼CR以éã®ï¼æ°ããæ¸å¼ã使ããã¨ã«ãªãï¼IE9 以ä¸ç¨ã¯ããã¾ã§éãï¼ã³ã³ãã£ã·ã§ãã«ã³ã¡ã³ãã®åããå´ã«æ¼ãè¾¼ãããªã©ãã¦ããï¼
background: -webkit-linear-gradient(top, #000, #fff); background: -moz-linear-gradient(top, #000, #fff); /* -moz-liner-gradient(to bottom, #000, #fff); */ background: -o-linear-gradient(top, #000, #fff); /* -o-liner-gradient(to bottom, #000, #fff); */ background: linear-gradient(to bottom, #000, #fff);
Opera 12.50 ã§ã® linear-gradient
Opera 12.50 ã§ã¯ï¼2012/08/10 ã® Snapshot/ 12.50.1546 ãã vendor-prefix ãç¡ããªãï¼IE10åæ§ï¼to
æãã®ã¿ã«å¯¾å¿ãï¼è§åº¦ã®æå®ã CR çã«å¯¾å¿ããããã«ãªã£ãï¼ããã« -o- ä»ãã®æå®ã¯ï¼ãã¹ã¦ç¡è¦ãããããã«ãªã£ãï¼
ãããã£ã¦ï¼vendor-prefix ä»ãã§å¤ãæ¸å¼ã¨ vendor-prefix ç¡ãã§ã® CR ç以éã®æ¸å¼ãä½µè¨ãããã¨ã§ï¼Opera 11.1x 以éã«ã¯ç¹ã«åé¡ãªãé©ç¨ããããã¨ã«ãªãï¼
ä»å¾ãã£ã¦ããé¢åãªäºæ ã®å¯è½æ§
ã¤ã¾ãã¨ããï¼æ··ä¹±æãå®å®æã®é ã«ããè¦ããã vendor-prefix ä»ãã¨ç¡ãã¨åãå 容ã§ã¤ãã¤ãã¨åæãã CSS ã§ã¯ï¼IE10 ã Opera 12.50 以éã«å¯¾å¿ã§ããªãï¼top ã left ã®æå®ã§ã¯å®å ¨ã«ç¡è¦ããã¦èæ¯ãã§ãªãã¨ãã£ãäºæ ã«ãªãï¼è§åº¦ã§ã®æå®ã§ã¯å ¨ãéãæ¹åã®ã°ã©ãã¼ã·ã§ã³ãæå®ãããäºæ ã«ãªãï¼
åæ··ä¹±æï¼ã®ç¯ã§çæ³çãªæå®æ¹æ³ãæãããï¼å®éã«ãã®æ§ã« to
ãè§åº¦ã®æå³è«ã vendor-prefix ã®æãç¡ãã§åãã¦æ¸ãã¦ããä¾ãããã»ã©è¦ãªãï¼åè¿°ã®ï¼Ultimete Gradient Generator ã¯å¯¾å¿æ¸ã¿ï¼ï¼CR çããã®å段éã® 20110711 çã§ã®ä»æ§å¤æ´ã«é¢ããè¨åãï¼å½å gradient ãå§ä¼ãããé ã«æ¯ã¹å°ãªãï¼ãããã®å¤ãä»æ§ã§ã®è§£èª¬è¨äºãæ´æ°ãããªãå¯è½æ§ãé«ãï¼ããï¼ãã§ã«ç¨¼åä¸ã®ã³ã¼ãã¯ãããããªäºæ
ã§æ´æ°ãããªãå¯è½æ§ãé«ãããï¼ãOS ãæ°ããããã ããï¼ããã©ã¦ã¶ãæ°ããããã ããã§ï¼ãµã¤ãã使ãç©ã«ãªããªããªã£ãã¨ãªãäºæ
ãå°ãªãããçºçããå¯è½æ§ãé«ãï¼
ã¾ã¨ã
Linear Gradients: the ‘linear-gradient()’ notation ã®ããã¾ã§ã®çµç·¯ã¨ï¼2011å¹´ç§ã«ãã£ãå ¨ãæå³ãç°ãªãã»ã©ã®ä»æ§å¤æ´ã¨ï¼2012å¹´ã®ç§å¬ã«ã¯ãã®ä»æ§ã«ã®ã¿å¯¾å¿ãããã©ã¦ã¶ãå°ãªãã¨ã 2ã¤ãªãªã¼ã¹ãããäºå®ãªã®ã§ï¼é¢ä¿è ã®æ¹ã¯ããããæ°ããä»æ§ã¸ã®æ¸ãæããå¿ è¦ãªããããªãã§ããããã¨ããã話ã§ããï¼
追è¨
ç¶ç·¨ (ã©ãæ¸ãã®ããã¿ã¼ãã£ã¦è©±ï¼Firefox 16 ã§ã®è©±ï¼Opera 12.50 ã 12.10 ã«ãªã£ã¦ -o- ä»ãã復活ãã話) ãã¨ã§æ¸ã
Opera 12.50 ã®å ´åï¼ããã« -webkit-prefix ã«çµ¡ãã 話ãããï¼ãããé¢åããã Mobile ã®æ¹ã§ -webkit- ã°ã£ããã ããï¼ãã¡ã -webkit-対å¿ãããï¼ã¨ä½è¨ã£ã¦ãã ããã¤ãã¿ãããªçºè¡¨ããã£ã¦ï¼ãã®å¾å®éã«ï¼Desktop 12.50.1497 ã§å®è£
ï¼ãã®æç¹ã§ããã¤ãã® CSS ããããã£ã¯ -o- 㨠-webkit- 両対å¿ã¨ãªã£ãï¼ããã«ï¼12.50.1546 ã§ï¼ãã®ãã¡ã®ããã¤ãã«ã¤ã㦠-o- ãå¤ãããã¨ã«ãªãï¼ãã¬ãã£ãã¯ã¹ãªã㨠-webkit- ä»ãã¨ããµãã¼ãããããã¨ã¨ãªã£ãï¼ 12.50 以éã® liner-gradient() ã¯ãã®ï¼ãã¬ãã£ãã¯ã¹ç¡ã㨠-webkit- ä»ãã¨ããµãã¼ããããããããã£ã®ãã¡ã®ä¸ã¤ãªã®ã ãï¼-webkit- ä»ãã®æ¹ã¯ 20110712 ç以åã®å¤ãæ¸å¼ã®ã¿ããµãã¼ãããï¼ãã¬ãã£ãã¯ã¹ç¡ãã®æ¹ã¯ CR çã®ã¿ããµãã¼ãããã¦ããï¼(cf. CSS vendor prefixes in Opera 12.50 snapshots) ãã®ããï¼æ°æ§ã®æ¸å¼ã¨ï¼-o- ãå«ãããã¬ãã£ãã¯ã¹ã®ããç¡ãã¨ãåæããã¨ãã«ã¯ï¼ãã®é çªçã«ãã£ã¦ç°ãªãçµæãçãï¼ åºæ¬çã«ï¼CSS ã®ä¸è¬çãªææ³ã«åã£ã¦ï¼ãæå¾ã«æå®ãããæå¹ãªããããã£ãé©ç¨ããããï¼ http://jsfiddle.net/4wHLD/ ã®ãµã³ãã«ç¾¤ã¯ï¼Opera 11.1x+ ã§ã¯ãã¹ã¦åãç½ããç·ã¸ã®ã°ã©ãã¼ã·ã§ã³ã«ãªããï¼12.50 ã§ã¯ï¼ããã¤ãã®ã±ã¼ã¹ã§ç°ãªãçµæã¨ãªãï¼ ä¾ãã°ï¼2a ã®ã±ã¼ã¹ã§ã¯ï¼ãã¬ãã£ãã¯ã¹ç¡ãã æ¡ç¨ããããã ãï¼
to
ãã¼ã¯ã¼ããç¡ãããï¼çµå± -webkit- ä»ããæ¡ç¨ããï¼ç½ããéã¸ã®ã°ã©ãã¼ã·ã§ã³ã¨æã£ã¦ããï¼2b ã®ã±ã¼ã¹ã§ã¯ï¼ãã¬ãã£ãã¯ã¹ç¡ãã®æå®ãæ¡ç¨ããç½ã¨èµ¤ã®ã°ã©ãã¼ã·ã§ã³ã«ãªã£ã¦ãããï¼è§åº¦ã®è§£éãæ°ä»æ§ã®ããæ¹åãä¸ä¸ã§ã¯ãªãå·¦å³ã¨ãªã£ã¦ããï¼