![]() |
Robert’s talk |
Firefox 3.6 / Gecko 1.9.2のCSSにはグラデーション機能が実装されている。この機能を利用すると背景のみならず要素ごとにグラデーションをかけることが可能になり、画像を使うことなく手軽に美しいUIを実現することができる。
グラデーション実装はFirefox以外のブラウザでも実現されている。Operaはまだ正式サポートしていないが、近いうちにサポートが実現するとみられる。IEではIE 5.5のころからサポートしており、WebKitを採用しているChromeとSafariでもサポートされている。IE8から名前が変わっているが指定する内容は同じまま。
CSSグラデーションは便利な機能だが、現状ではIE、Firefox、WebKit (Chrome、Safari)で指定方法が違うという状況にある。最終的にはFirefoxで実装された指定方法で一本化していくのではないかとみられるが、それまでは個々に対応する必要がある。
|
|
Firefox 3.6 - CSS gradients for all web browsers, without using imagesサンプルのレンダリング例 |
Chrome - CSS gradients for all web browsers, without using imagesサンプルのレンダリング例 |
|
|
IE8 - CSS gradients for all web browsers, without using imagesサンプルのレンダリング例 |
Safar4 - CSS gradients for all web browsers, without using imagesサンプルのレンダリング例 |
Robert Nyman氏がCSS gradients for all web browsers, without using images - Robert's talkにおいて、IE5.5-7、IE8、Firefox 3.6、Safari4、Chromeのそれぞれで同じグラデーションをレンダリングするためのCSSのサンプルを公開している。ブラウザごとにどのように指定が違っているのか比較できて参考になる。CSS gradients for all web browsers, without using images - Robert's talkに掲載されているサンプルをそのままためせるようにまとめたものを次に掲載しておく。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>グラデーションデモ</title>
<style type="text/css">
#gradient {
color: #fff;
height: 100px;
padding: 10px;
/* For WebKit (Safari, Google Chrome etc) */
background: -webkit-gradient(linear, left top, left bottom, from(#00f), to(#fff));
/* For Mozilla/Gecko (Firefox etc) */
background: -moz-linear-gradient(top, #00f, #fff);
/* For Internet Explorer 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#FF0000FF, endColorstr=#FFFFFFFF);
/* For Internet Explorer 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FF0000FF, endColorstr=#FFFFFFFF)";
}
</style>
</head>
<body>
<div id="gradient">
グラデーション
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>グラデーションデモ</title>
<style type="text/css">
#gradient-with-stop {
color: #fff;
height: 100px;
padding: 10px;
/* For WebKit (Safari, Google Chrome etc) */
background: -webkit-gradient(linear, left top, right top, from(#00f), to(#fff), color-stop(0.7, #fff));
/* For Mozilla/Gecko (Firefox etc) */
background: -moz-linear-gradient(left top, #00f, #fff 70%);
/* For Internet Explorer 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#FF0000FF, endColorStr=#FFFFFFFF, GradientType=1);
/* For Internet Explorer 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FF0000FF, endColorstr=#FFFFFFFF, GradientType=1)";
}
</style>
</head>
<body>
<div id="gradient-with-stop">
グラデーション
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>グラデーションデモ</title>
<style type="text/css">
#gradient-radial {
color: #fff;
width: 100px;
height: 100px;
padding: 10px;
/* For WebKit (Safari, Google Chrome etc) */
background: -webkit-gradient(radial, 40% 40%, 0, 40% 40%, 60, from(#ffffa2), to(#00f));
/* For Mozilla/Gecko (Firefox etc) */
background: -moz-radial-gradient(40% 40%, farthest-side, #ffffa2, #00f);
/* For Internet Explorer */
/* As if... */
}
</style>
</head>
<body>
<div id="gradient-radial">
グラデーション
</div>
</body>
</html>
| HTML5 video、ブラウザ対応状況とコーデックまとめ [2010/1/27] |
| JavaSriptとCSSの結合/圧縮ツール14 [2010/1/22] |
| アイシンの最新安全運転システム - 車両周辺・後方障害物監視、わき見・居眠り判断 [10:30 5/28] |
| ラネクシー、画像処理ソフトウェア開発キットの最新版を64bit版で販売 [10:10 5/28] |
| 東陽テクニカ、1G/10GbE回線対応のポータブルネットワークアナライザ [09:57 5/28] |
| 日本発の取り組み「Mozilla Factory」がスタート [09:30 5/28] |
| 【レポート】クラウド/モバイル/ビッグデータ時代に求められるUIとは - TOBESOFT 金代表 [09:00 5/28] |
|
ローランド、iPhone・iPadでレコーディングできる無料アプリをリリース [15:08 5/28] クリエイティブ |
|
【女性編】あこがれの場所へ1日限定で1カ所だけ行けるなら、あなたはどこへ行きますか?ランキング [15:00 5/28] ライフ |
|
【男性編】あこがれの場所へ1日限定で1カ所だけ行けるなら、あなたはどこへ行きますか?ランキング [15:00 5/28] ライフ |
|
SKE48の松井玲奈、総選挙7位の速報に「ファンの期待を裏切らないように」 [15:00 5/28] エンタメ |
|
[檀れい]初共演・坂東玉三郎の演出で「一日1ミリでも成長したい」 [14:54 5/28] エンタメ |
4つの診断で、自分の適性を見つめなおそう!
働くこと・挑戦し続けることへの思いを綴ったインタビュー
あなたにピッタリのアドバイスを読むことができます。
転職に必要な情報が収集できます
企業からアプローチのメッセージが届きます。