Webデザイナーへの道しるべ | suge1040's diary

Webデザイナーになる事を目指しフェリカテクニカルアカデミーで勉強していましたsuge1040によるブログです。

6/18(水)授業メモ

今日は、CSS3を使ってグラデーションの設定を学びました。

学校ブログ 7/29を参照

 

mozilla系のブラウザ用の命令

記述例 )background:-moz-linear-gradient(top, #990, #066);

解説 ) background:-moz-linear-gradient (方向, 開始色, 終了色);

 方向の種類

  • top:上から下
  • left:左から右
  • left top:左上から右上

※ mozilla系のブラウザ には、 Mozilla Fierfox が含まれる。

 

webkit系のブラウザ用の命令

記述例 )background: -webkit-gradient(linear, left top, left bottom, from(#990), to(#066));

解説 ) background: -webkit-gradient(直線的, 開始位置, 終了位置, 開始色, 終了色

※ webkit系のブラウザ とは、KHTMLレンダリングエンジン

※ webkit系のブラウザ には、GoogleChromeOperaSafari が含まれます。

 

例)

<!DOCTYE html>
<html>
<head>
<meta charset="UTF-8">
<title>CSS3 グラデーション</title>
<style>
#grad1, #grad2, #grad3, #grad4, #grad5 {
  width: 300px;
  height: 200px;
  margin: 30px 50px;
}
#grad1 {
  background: -moz-linear-gradient(top, #990, #066);
  background: -webkit-gradient(linear, left top, left bottom, from(#990), to(#066));
}
#grad2 {
  background: -moz-linear-gradient(left, #990, #066);
  background: -webkit-gradient(linear, left top, right bottom, from(#990), to(#066));
}
#grad3 {
  background: -moz-linear-gradient(left top, #990, #f60 50%, #066);
  background: -webkit-gradient(linear, left top, right bottom, from(#990), color-stop(0.5, #f60), to(#066));
}
#grad4 {
  background: -moz-linear-gradient(left top, #990, #c36 30%, #f60 50%, #000 70%, #066);
  background: -webkit-gradient(linear, left top, right bottom, from(#990), color-stop(0.3, #c36), color-stop(0.5, #f60), color-stop(0.7, #000), to(#066));
}
#grad5 {
  background: -moz-linear-gradient(top, rgba(60,100,50,0.5), #066);
  background: -webkit-gradient(linear, left top, left bottom, from(rgba(60,100,50,0.5)), to(#066));
}
</style>
</head>
<body>
<div id="grad1"></div>
<div id="grad2"></div>
<div id="grad3"></div>
<div id="grad4"></div>
<div id="grad5"></div>
</body>
</html>