#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
设置文字水平居中