[CSS]CSS3グラデーションの表示サンプルと指定方法のまとめ
現在、Firefox, Safari, Chromeで利用できるCSS3グラデーションの表示サンプルと指定方法のまとめをDynamic Driveから紹介します。

CSS Library:CSS3 Linear Gradients
下記は各ポイントをピックアップしたものです。
CSS3グラデーションの基礎知識
CSS3グラデーションをサポートしているブラウザは現在のところ、下記の三つです。
- Firefox 3.6+
- Safari 2+
- Chrome
CSS3グラデーションの対応エレメントは、下記の二つです。
- background
- background-image
CSS3グラデーションの指定方法はmoz系(Firefox)とwebkit系(Safari, Chrome)で異なり、下記のようになります。
moz系
-moz-linear-gradient(|| , color-stops)
webkit系
-webkit-gradient(linear,, color-stops)
表示サンプルと指定方法

左から右へのグラデーション
background: -moz-linear-gradient(left, #00abeb, #fff); background: -webkit-gradient(linear, left center, right center, from(#00abeb), to(#fff));

右から左へのグラデーション
background: -moz-linear-gradient(right, #00abeb, #fff); background: -webkit-gradient(linear, right center, left center, from(#00abeb), to(#fff));

上から下へのグラデーション
background: -moz-linear-gradient(top, #00abeb, #fff); background: -webkit-gradient(linear, center top, center bottom, from(#00abeb), to(#fff));

下から上へのグラデーション
background: -moz-linear-gradient(bottom, #00abeb, #fff); background: -webkit-gradient(linear, center bottom, center top, from(#00abeb), to(#fff));

左上から右下へのグラデーション
background: -moz-linear-gradient(left top 315deg, #00abeb, #fff); background: -webkit-gradient(linear, left top, right bottom, from(#00abeb), to(#fff));

右上から左下へのグラデーション
background: -moz-linear-gradient(right top 225deg, #00abeb, #fff); background: -webkit-gradient(linear, right top, left bottom, from(#00abeb), to(#fff));

左から右へのグラデーションで途中でとめる
background: -moz-linear-gradient(left, #00abeb, #fff 45%); background: -webkit-gradient(linear, left center, right center, from(#00abeb), color-stop(45%, #fff));

左上からオレンジ・イエロー・ホワイトのグラデーション
background: -moz-linear-gradient(left top 315deg, orange, yellow 30%, white 40%); background: -webkit-gradient(linear, left top, right bottom, from(orange), color-stop(30%, yellow), color-stop(40%, white));

暗いブルーと明るいブルーと中間のブルーを均等にフェードさせるグラデーション
background: -moz-linear-gradient(center top, #b8d8f2, #92bde0 25%, #3282c2 50%, #92bde0 75%, #b8d8f2); background: -webkit-gradient(linear, center top, center bottom, from(#b8d8f2), color-stop(25%, #92bde0), color-stop(50%, #3282c2), color-stop(75%, #92bde0), to(#b8d8f2));

7色のレインボーカラーのグラデーション
background: -moz-linear-gradient(left, red, orange, yellow, green, blue, indigo, violet); background: -webkit-gradient(linear, left center, right center, from(red), color-stop(14%, orange), color-stop(28%, yellow), color-stop(42%, green), color-stop(56%, blue), color-stop(70%, indigo), to(violet));
Post on:2010年3月18日








Comments
10時のヘッドライン | CROSS SBM
on 2010年3月18日
[...] – IDEA*IDEA ~ 百式管理人のライフハックブログはてブ:8 fc2:1 [CSS]CSS3グラデーションの表示サンプルと指定方法のまとめ | コリスはてブ:12 [...]
14時のヘッドライン | CROSS SBM
on 2010年3月18日
[...] : ドコモ スマートフォン Xperia(TM)を発売 | お知らせ | NTTドコモはてブ:5 [CSS]CSS3グラデーションの表示サンプルと指定方法のまとめ | コリスlivedoor:3 リンジー・ローハン、新恋人は男性です。newsing:1 [...]
freewebdev.jp
on 2010年3月18日
CSS3グラデーションの表示サンプルと指定方法のまとめ
「CSS Library:CSS3 Linear Gradients」
CSS3のプロパティの一つである linear-gradient(背景のグラデーション)の表示サンプルと指定方法のまとめです。
単純な物から、虹のようなやや複雑なグラデーシ…
CSS3で線形グラデーションを表現 | CSSリファレンス
on 2012年3月16日
[...] コリス [...]