1.CSS 三大实现形式:
(1)内嵌形式:style="color : red"
(2)文件头部:<style> ...... </style>
(3)外链文件:<link rel="stylesheet" href=".......
?v=1.1(强行更新页面,缓存有关)
">
2.CSS三大选择器:(包括很多内嵌形式 如:#id .class)
(1)标签选择器:如div{}
(2)ID选择器:ID在CSS中是唯一的 ,如:#id{}
(3)class选择器: 如:. class
3.颜色的表现方式:
(1)英文单词 : 如 : green
(2)十六进制 : 如:#FFFFFF 白色 #000000黑色
(3)RGB : 如:rgba( 0,0,0,0.1)黑色透明度 ,rgb(255,255,255)白色
(4)opacity :设置透明度
4.background背景:
background:color image repeat attachment position
background - color:
background - image : url(“地址”)
background -repeat : no-repeat / repeat / repeat-x / repeat-y
background -position : length length / position position 如 top center
background -attachment : fixed(固定) / scroll(浮动)
5.text文字:
text -align : center/left/right
text -decoration : none/underline/overline/line-through/blink(闪烁)
text -indent: 2em px
text -shadow :color/lenght/lenth/opacity
line-height:px
6.font文字:
font:style/variant/weight/size/line-heidht/family
font -style : normal(正常)/italic(斜体)/oblique(斜体)
font -variant: normal(正常的字体)/small-caps(小型的大写字母字体)
font -size:px
font -family:字体
font -weight:px
7.border 边框:
border :width/style/color
border -style : none/hidden/dotted/dashed/solid/doble/
border-top/right/bottom/left : px
border- color :
border-width : px
border -collapse : collapse(合并边框) / inherit (继承)/ initial /separate(分开边框)
border -radius :px
8.margin外边距
margin:上 右 下 左
margin -top : px
margin -right : px
margin -left : px
margin -bottom :px
9.padding 内边距
padding:上 右 下 左
padding -top :px
padding -left : px
padding -bottom : px
padding -right : px
10.position定位:(原点为左上角)
position: absloute 产生绝对定位的元素,相对于static定位以外的第一个夫元素进行定位。元素的位置通过left、top、right 、bottom属性进行定位。
position :relative 产生相对定位的元素(相对临近的元素的定位),相对于浏览器窗口进行定位。
position :static(默认值)没有定位。
position :fixed 产生绝对定位,相对于浏览器窗口进行定位。
11.z-index 显示次序:
z-index :负数(一般最低层显示)
z-index :正数(越大显示越前面)
12.display显示
display : none 元素不会被显示(隐藏,不会保留位置)
visiblity: hidden 元素不会被显示(隐藏,会保留位置)
display : block 元素将被显示为块级元素,即元素前后会带有换行符
diaplay : inline (默认)元素会被显示为内联元素,元素前后没有换行符
display : inline-block 行内快元素(inline与block的结合)
13.float浮动(浮动元素会生成一个块级框,不论它本身是何种元素)
float : left 向左浮动
float : right 向右浮动
float : none(默认值,不浮动)
clean :both 清除浮动
14.尺寸:
width : px 宽
height : px 高
min-width : px 最小宽度
max-width : px 最大宽度
min-height : px 最小高度
max-height : px 最大高度
15. outline轮廓
outline : color style width
outline-style : none (无边框)/ dotted(点线边框) / dashed (虚线边框)/
solid (实线边框)/double(双边框)
outline-width : px
outline-color : px
16. overflow
overflow : visible(默认值,内容不会被修剪)
overflow : hidden(隐藏超出范围的内容)
overflow : scroll(内容会被修剪,但会产生滚动以便查看其余内容)
overflow :auto ( body与textarea的默认值,在需要时剪切内容并添加滚动 )
17.css优先级:
1) color:yellow !important;
2) style=“color:yellow”
3) id{ color:yellow }
4) class{ color:yellow }
5) div{ color:yellow }
6) *{ color:yellow }
18.盒子模型是由margin(边界)、border(边框)、padding(空白)和content(内容)几个属性组成
content(内容):盒子模型中必需的部分,可以是文字、图片等元素
padding(空白):也称页边距或补白,用来设置内容和边框之间的距离
border(边框):可以设置内容边框线的粗细、颜色和样式等。
margin(边界):外边距,用来设置内容与内容之间的距离