2015年1月21日 星期三

104-01-20_css

CSS

css一種用來為結構化文件(如html)添加樣式(字型、間距和顏色等)的語言。
宣告或引用要在<head></head>之間。

selector(名稱){
  property(屬性):value(值);
}



property屬性:

color:設定顏色

text-decoration文字修飾,常用的值:
none:默認,沒有修飾;
underline:文字加底線;
line-through:文字中加線,類似刪除線。

font-size:字體大小

display顯示,常用的值:
none:不會顯示;
inline:預設,不換行顯示;
block:換行顯示。


selector(名稱):
p:設定所有的所有的p、
li:設定所有的li、
ul li:設定ul下的li、
ol li:first-child:設定ol的第一個li

跟超連結有關的設定:
a:hover:設定移上去,未按時的
a:link:設定未連結過的
a:visited:設定連結過的
a:active:設定按下時的


顏色
  紅綠藍
#FF00FF
00-FF表示0~255,共256個,0表示沒有填色,F代表填滿顏色。
黑色:#FFFFFF
白色:#000000

顏色表示為16進位,
A=10
B=11
C=12
D=13
E=14
F=15
FF=15*16+15*1=255,
總顏色共有256*256*256=16,777,216


排版相關設定,margin邊界,border邊框,padding留白,其在頁面中位置由內到外:
content->padding->border->margin

padding留白順序為上、右、下、左
padding:top right bottom left;

border設定:寬度、樣式、顏色
border:width style color;

margin邊界順序圍上、右、下、左
margin:top right bottom left;

若想去除所有預設格式,將padding、border、margin都設為0就行了。


架構:
<!DOCTYPE html>
<html>
 <head>
  <title></title>
  <style type="text/css">
  body{
    padding:0;
    border:0;
    margin:0;
  }
  p{
    color:green;
  }
  li{
    color:pink;
  }
  ul li{
    color:blue;
  }
  </style>
 </head>
 <body>
  <h1></h1>
  <p></p>
  <h2></h2>
  <ul>
   <li><a herf="http://..."></a></li>
   <li><a herf="http://..."></a></li>
   <li><a herf="http://..."></a></li>
  </ul>
  <h2></h2>
  <ol>
   <li></li>
   <li></li>
   <li></li>
  </ol>
 </body>
</html>

沒有留言:

張貼留言