天天看點

前端學習随筆 css篇

CSS

css是英文Cascading Style Sheets的縮寫,稱為層疊樣式表,用于對頁面進行美化。

存在方式有三種:元素内聯、頁面嵌入和外部引入,比較三種方式的優缺點。

文法:style = 'key1:value1;key2:value2;'

  • 在标簽中使用 style='xx:xxx;'
  • 在頁面中嵌入 < style type="text/css"> </style > 塊
  • 引入外部css檔案

标簽選擇器

div{

background-color:red;

}

<div > </div>

class選擇器

.bd{

<div class='bd'> </div>

id選擇器

#idselect{

<div id='idselect' > </div>

關聯選擇器

#idselect p{

<div id='idselect' >

<p> </p>

</div>

組合選擇器

input,div,p{

}

屬性選擇器

input[type='text']{

width:100px;

height:200px;

}        

div{ background-color:red; }

<div > </div>  

屬性大全

轉載:http://wenku.baidu.com/link?url=3faEGwVL6SjsWQTbP94gizaH2qI27vd7sVRZCpc778gKH4Z9Y4plaIVukou2rsdH4SljvYHDm83x7JalgTG-D3DsdnmxnSrDtbfRHq830C3