#css基本語法及頁面引用
##css基本語法
css的定義方法是:css
選擇器 { 屬性:值; 屬性:值; 屬性:值;}ide
選擇器是將樣式和頁面元素關聯起來的名稱,屬性是但願設置的樣式屬性每一個屬性有一個或多個值。代碼示例:字體
div{ width:100px; height:100px; color:red }
##css頁面引入方法:
一、外聯式:經過link標籤,連接到外部樣式表到頁面中。code
<link rel="stylesheet" type="text/css" href="css/main.css">
二、嵌入式:經過style標籤,在網頁上建立嵌入的樣式表。orm
<style type="text/css"> div{ width:100px; height:100px; color:red } ...... </style>
三、內聯式:經過標籤的style屬性,在標籤上直接寫樣式。it
<div style="width:100px; height:100px; color:red ">......</div>
##css文本設置
經常使用的應用文本的css樣式:io
color:red
;font-size:12px
;font-family:'微軟雅黑'
;font-style:'normal'
;設置不傾斜,font-style:'italic'
;設置文字傾斜font-weight:bold
; 設置加粗 font-weight:normal
設置不加粗font:normal 12px/36px '微軟雅黑'
;line-height:24px
;text-decoration:none
; 將文字下劃線去掉text-indent:24px
; 設置文字首行縮進24pxtext-align:center
設置文字水平居中