CSS3 系列教程

來源:互聯網
上載者:User

標籤:http   io   ar   color   使用   sp   strong   on   div   

一、首碼:
  -moz(例如 -moz-border-radius)用於Firefox
  -webkit(例如:-webkit-border-radius)用於Safari和Chrome。

二、CSS3圓角(所有的)
  -moz-border-radius: 15px;
  -webkit-border-radius: 15px;

三、CSS3圓角(個別的)
  -moz-border-radius-topleft: 15px;
  -moz-border-radius-topright: 0px;
  -moz-border-radius-bottomright: 15px;
  -moz-border-radius-bottomleft: 0px;
  -webkit-border-top-left-radius: 15px;
  -webkit-border-top-right-radius: 0px;
  -webkit-border-bottom-left-radius: 0px;
  -webkit-border-bottom-right-radius: 15px;

四、CSS3中的邊框顏色:
  使用CSS3的border-radius屬性,如果你設定了border的寬度是X px,
  那麼你就可以在這個border上使用X種顏色,每種顏色顯示1px的寬度。
  如果說你的border的寬度是10個像素,但是只聲明了5或6中顏色,那麼最後一個顏色將被添加到剩下的寬度。

  目前只有Firefox支援CSS3 border-colour屬性,所以我們這裡只需使用-moz首碼。


  -moz-border-bottom-colors: #300 #600 #700 #800 #900 #A00;
  -moz-border-top-colors: #300 #600 #700 #800 #900 #A00;
  -moz-border-left-colors: #300 #600 #700 #800 #900 #A00;
  -moz-border-right-colors: #300 #600 #700 #800 #900 #A00;

五、陰影
  大約從CSS2就開始有了,但是只有Safari一個瀏覽器支援它,到現在依然是這樣。
  CSS3的box-shadow和textshadow可以寫做:box-shadow:Apx Bpx Cpx #xxx;
  Apx = x軸
  Bpx = y軸
  Cpx = 投影長度
  #XXX = 像通常一樣的顏色

  #boxShadow{
  border: 5px solid #111;
  -webkit-box-shadow: 5px 5px 7px #999;
  -webkit-border-bottom-right-radius: 15px;
  padding: 15px 25px;
  height: inherit;
  width: 590px;
  }

六、簡單文字陰影
  .textShadowSingle {
  font-size: 3.2em;
  color: #F5F5F5;
  text-shadow: 3px 3px 7px #111;
  text-align: center;
  }

七、多重文字陰影:
  .textShadowMultiple {
  font-size: 3.2em;
  color: #FFF;
  text-shadow: 0px -11px 10px #C60, 0px -3px 9px #FF0;
  text-align: center;
  padding: 10px 0px 5px 0px;
  background: #151515;
  }

八、背景圖片/紋理
  CSS3的背景圖片大小可以寫成 background-size:Apx Bpx;
  -Apx = x軸(圖片寬度)
  -Bpx = y軸(圖片高度)

  最好支援CSS3背景大小的瀏覽器是Safari和Opera,所以我們只需要使用-o和-webkit首碼。
  #backgroundSize{
  border: 5px solid #bd9ec4;
  background:url(image_1.extention) bottom right no-repeat;
  -o-background-size: 150px 250px;
  -webkit-background-size: 150px 250px;
  padding: 15px 25px;
  height: inherit;
  width: 590px;
  }
九、多背景圖片
  background: url(image_1.extention) top right no-repeat, url(image_2.extention) bottom right no-repeat;
  #backgroundMultiple{
  border: 5px solid #9e9aab;
  background:url(image_1.extention) top left no-repeat,
  url(image_2.extention) bottom left no-repeat,
  url(image_3.extention) bottom right no-repeat;
  padding: 15px 25px;
  height: inherit;
  width: 590px;
  }

十、CSS3多列(寬度)
  #multiColumnWidth {
  text-align: justify;
  -moz-column-width: 20em;
  -moz-column-gap: 2em;
  -webkit-column-width: 20em;
  -webkit-column-gap: 2em;
}
十一、CSS3多列(列數)
  #multiColumnCount {
  text-align: justify;
  -moz-column-count: 3;
  -moz-column-gap: 1.5em;
  -moz-column-rule: 1px solid #dedede;
  -webkit-column-count: 3;
  -webkit-column-gap: 1.5em;
  -webkit-column-rule: 1px solid #dedede;
  }


十二、CSS3嵌入字型
  @font-face {
  font-family: qianduanNet;
  src: url("SketchRockwell.ttf");
  }
  .fontFace{
  font-family: qianduanNet;
  font-size: 3.2em;
  letter-spacing: 1px;
  text-align: center;
  }

十三、CSS3透明(例1:層)
  div.opacityL1 { background:#036; opacity:0.2; width:575px; height:20px; }
  div.opacityL2 { background:#036; opacity:0.4; width:575px; height:20px; }
  div.opacityL3 { background:#036; opacity:0.6; width:575px; height:20px; }
  div.opacityL4 { background:#036; opacity:0.8; width:575px; height:20px; }
  div.opacityL5 { background:#036; opacity:1.0; width:575px; height:20px; }
十四、CSS3 RGBA 色彩
  div.rgbaL1 { background:rgba(153, 134, 117, 0.2); height:20px; }
  div.rgbaL2 { background:rgba(153, 134, 117, 0.4); height:20px; }
  div.rgbaL3 { background:rgba(153, 134, 117, 0.6); height:20px; }
  div.rgbaL4 { background:rgba(153, 134, 117, 0.8); height:20px; }
  div.rgbaL5 { background:rgba(153, 134, 117, 1.0); height:20px; }

十五、CSS3 HSL
  HSL聲明使用色調Hue(H)、飽和度Saturation(s)和亮度Lightness(L)來設定顏色。
  Hue衍生於色盤:0和360是紅色,接近120的是綠色,240是藍色。
  Saturation值是一個百分比:0%是灰階,100%飽和度最高
  Lightness值也是一個百分比:0%是最暗,50%均值,100%最亮。
  div.hslL1 { background:hsl(320, 100%, 50%); height:20px; }
  div.hslL2 { background:hsl(320, 50%, 50%); height:20px; }
  div.hslL3 { background:hsl(320, 100%, 75%); height:20px; }
  div.hslL4 { background:hsl(202, 100%, 50%); height:20px; }
  div.hslL5 { background:hsl(202, 50%, 50%); height:20px; }
  div.hslL6 { background:hsl(202, 100%, 75%); height:20px; }
十六、CSS3 HSLA
  div.hslaL1 { background:hsla(165, 35%, 50%, 0.2); height:20px; }
  div.hslaL2 { background:hsla(165, 35%, 50%, 0.4); height:20px; }
  div.hslaL3 { background:hsla(165, 35%, 50%, 0.6); height:20px; }
  div.hslaL4 { background:hsla(165, 35%, 50%, 0.8); height:20px; }
  div.hslaL5 { background:hsla(165, 35%, 50%, 1.0); height:20px; }

 

http://www.blueidea.com/tech/web/2009/6460.asp

CSS3 系列教程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.