CSS简短总汇1

CSS 层叠样式表。Cascading Style Sheet

一、层叠样式表的分类: 1.外部——.css文件 2.内嵌——<head></head> 3.内联——放在标记的style属性上

二、选择器。 (一)基本选择器 1.ID选择器:# 2.class选择器:. 3.标签选择器:标签名

(二)组合选择器 1.用逗号隔开。并列关系 2.用空格隔开。后代关系。 3.筛选:选择器.class选择器。

“层叠”的意思? 1.样式表类型的层叠。——例子。 2.选择器的层叠。——例子 3.父子元素的层叠。——例子。

优先级: 1.一般来说,ID选择器优先级要高于class选择器的优先级,class选择器的优先级高于标签选择器的优先级。 2.对于同一类型的选择器,内联样式的优先级要高于内嵌,内嵌样式的优先级要高于外部的。

三、样式表的属性: (一)前景与背景 1.背景: background-color:背景色。 background-image:url(路径)  背景图 background-attatchment:  fixed-背景固定;scroll-背景与文字一起滚动 background-repeat: repeat:平铺;no-repeat:不平铺; repeat-x,repeat-y. background-position: right 100px bottom 200px;

2.前景: font-family: font-size: color: font-weight:bold(加粗) font-style:italic(倾斜) text-decoration: underline(下划线),overline(上划线),line-through(删除线) text-align: left,center,right vertical-align: top,middle,bottom line-height:行高。一般是font-size的1.5-2(em)倍。

(二)边界与边框 1.边框:二维表格。 2.外边距:margin(表外间距-上、右、下、左),margin-top,.... 3.内边距:padding(内容与单元格间距-上、右、下、左),padding-top......

posted on 2015-04-17 20:40  冰冥寒流  阅读(139)  评论(0编辑  收藏  举报