1.替换元素:元素内容非文档内容直接显示而由外部内容替换,如img,input(type指定)
2.<link>属性media:all所有表现媒体/screen屏幕媒体/print打印机,title生成候选样式列表
3.@import url(eg.css)需置于其他样式之上否则无效,可在style或样式表中引入样式表
4.优先级:内联样式>文档样式表>外部样式表
5.选择器:
<1>选择器分组 ,
<2>通配选择器 *
<3>元素选择器 h1
<4>类选择器 .
<5>id选择器 #
<6>属性选择器
属性:h1[a][b] 同时包含a,b属性的h1
属性值:h1[a=1]属性与值匹配的选项
属性值开头:h1[a^ =1]
属性值结尾:h1[a$=1]
属性值包含:h1[a*=1]
属性值包含子串(适用于空格分隔的属性):h1[a~=1]
属性值前缀包含子串(适用于连字符分隔的属性):h1[a| =1]
<7>后代选择器 空格
<8>父子选择器 >
<9>相邻兄弟选择器 +(后面第一个兄弟元素) ~兄弟选择器(后面所有兄弟元素)
<10>伪类选择器(推荐顺序)
:link :visited :focus :hover :active(后三个为动态伪类,可应用于所有元素)
:first-child :last-child :only-child :nth-child(odd/even/2n+1...)
eg: p:first-child作为某元素的第一个p元素
E:first-of-type第一个孩子且限制是E元素 :last-of-type :nth-of-type(n) :nth-last-of-type(n)
:target为锚点目标添加元素
:selection设定选定内容样式
:lang(语言)
:root整个DOM的元素定点,即html
:not排除特定的元素
:empty比如一个列表空的那个元素
:disabled不可以使用时,触发
:read-only只读时,触发
:read-write可读可写时,触发
:checked被勾选触发
<11>伪元素选择器(一般用::与伪类区分开)
::first-letter块级元素首字母 ::first-line第一个文本行
::before ::after
(用于插入生成的内容,content属性,若选择器主体为行内元素则生成内容不能为块级元素)
::placeholder设置对象文字占位符的样式
6.选择器的特殊性(优先级);继承;层叠
内联样式 id 类(伪类) 元素(伪元素)
0 0 0 0
重要声明!important
7.字体
font-family字体系列(有多个则用逗号隔开,当字体包含空格或# $等符号则应用引号包裹)
font-weight字体加粗:bold / bolder / lighter / normal / inherit / 100-900(400normal,700bold)
font-size字体大小:small / medium / large /smaller / larger / inherit / 百分比 / 像素
font-style字体风格:inherit / normal / italic斜体 / oblique倾斜文本
font-variant字体变形:small-caps小型大写字母 / inherit / normal
font:font-style font-variant font-weight font-size / line-height font-family
(前三者任意顺序且可选,字体大小和系列必选且前后位置不可变)
@font-face { font-family:‘自定义字体’;src:url(...) }
8.文本
text-indent缩进
text-align水平对齐方式(应用于块级元素):left / right / center / inherit / justify两端对齐文本
vertical-align垂直对齐(应用于行内元素和替换元素 表单元格) top / middle / bottom / baseline / text-bottom / text-top / sub / super / 百分数(相对于行高) / 长度值 / inherit
line-height行高
word-spacing字间隔
letter-spacing字母间隔
text-transform文本转换:capitalize首字母大写 / uppercase / lowercase / none / inherit
text-decoration文本装饰:none / inherit / underline / overline / line-through / blink闪烁
text-shadow文本阴影:color颜色 x轴偏移量 y轴偏移量 blur模糊半径
direction方向:rtl右到左 / ltr左到右 / inherit
white-space处理空白符:normal / inherit / nowrap / pre / pre-wrap / pre-line
9.垂直相邻外边距会合并。外边距为透明,父元素颜色可透过。若边框无设置颜色,则同元素前景色一样(color)
10.display:none / inline / block / inline-block / list-item / table / flex / inline-flex...
11.改变纯文本行的行间距的只有font-size,line-height,vertical-align
12.width,height应用于块级元素和替换元素
13.border-style:solid / dotted / dashed / double / outset / inset / groove / ridge / none / hidden / inherit
“border-style:solid dotted dashed double;”对应上右下左边框
14.border-width:thin / thick / medium / inherit
15.background-color:“color” / inherit / transparent
16.background-image:url( ) / none / inherit
17.background-repeat:repeat / no-repeat / repeat-x / repeat-y / inherit
18.background-position:left / right / bottom / top / center / 长度值(偏移) / 百分比(成对出现,代表水平垂直方向的位置,若只出现一个则另一个默认为center)
19.background-attachment:scroll / fixed / inherit;
背景显示区域background-clip:border-box/paddind-box/content-box/text;
背景原点background-origin:border-box/paddind-box/content-box
20.background-size:长度值 / 百分比(100% 100%) / contain宽高适应(可能失真) / cover覆盖(可能截取)
21.float(浮动需指定宽度,脱离文档流,块级元素顶上,内联元素围绕 , 此时浮动元素display值为block):left / right / inherit / none
22.clear(清除浮动):left / right / both / inherit / none
23.position(定位):static / absolute(相对页面) / fixed(相对视窗) / relative(偏移量) / inherit
24.min/max-height(width) , max-height重载覆盖height , min-height重载覆盖max-height , 多用min-height , 防止容器"塌陷"影响美观且还能随内容增多而撑大 , max-height少用 , 用于限制容器内元素 , 防止过大撑破容器
25.overflow(溢出):hidden / visible / inherit / auto / scroll (clip定义裁剪区域形状 visibility)
26.z-index(应用于定位元素):inherit / auto / 值
27.caption-size表格标题位置:top / bottom
28.border-collapse表单元格边框:separate分隔边框 / collapse合并边框 / inherit
29.cellspacing单元格间隔(分隔边框时才适用,有两个长度值时表示水平与垂直间隔):长度值
30.cellpadding单元格内边距
31.empty-cells处理空单元格(分隔边框时才适用):show / hide / inherit
32.list-style-type列表类型:disc / circle / square / decimal / upper-roman / lower-roman / upper-alpha / lower-alpha
33.list-style-image列表项图像:url / none / inherit
34.list-style-position列表标志位置:outside / inside / inherit
35.cursor光标:auto / default / inherit / pointer / url() / wait / help / text...
36.outline(style,width,color)轮廓:同边框,solid...,input,select,textarea等标签带有 , 不占据空间
37.内联元素宽高和上下内外边距不可设置
38.盒模型:标准模型width为content,IE模型为content+padding+border,box-sizing:content-box / border-box
39.css变量:声明变量时变量名前要加两根连词线(--),var()函数用于读取变量,第二个参数可作为默认值
40.calc动态计算长度值:运算符前后都需要保留一个空格,例width: calc(100% - 10px);
41.zoom:设置或检索对象的缩放比例
42.::-webkit-input-placeholder设置input样式
43.pointer-events:none;禁止点击事件
44.user-select(除替换元素外)设置或检索是否允许用户选中文本:none / text / all / element
45.border-radius圆角:设50%(设为宽高一半,兼容较好)时为圆形
46.box-shadow框阴影(可设多重阴影,用逗号隔开):x y blur 尺寸 color 内外(inset/outset)
47.background:linear-gradient线性渐变,radial-gradient径向渐变
48.border-image: linear-gradient...边框渐变(iE不兼容)
49.Flow流,块级元素自上而下,内联元素左上至右下 , 浮动块元素上下外边距并不会合并
50.transform变换:translate(X Y)位移 / scale(值)伸缩 / skew(deg)斜切 / rotate旋转(deg) rotateX(Y),旋转基点 transform-origin:left top;
51.transition动画:transition-property动画属性 / transition-duration持续时间 / transition-timing-function动画效果 / transition-delay延迟时间 (兼容写法时,标准写法放最后)
简写:transition: transform 2s linear 1s;
52.animation自定义动画:animation-name动画名称 / animation-duration持续时间 / animation-delay延迟时间 / animation-timing-function时间函数(ease-in-out等) / animation-fill-mode动画结束状态(forwards停在结束状态,backwards停在开始状态) / animation-iteration-count动画次数(infinite无限次,值) / animation-direction动画路径(alternate动画结束后原路返回,reverse倒序播放,alternate-reverse倒序播放结束后原路返回) / animation-play-state声明动画播放状态(running自动播放,paused停止状态)
@keyframes+自定义动画名{ }
53.animation-timing-function: linear匀速 / ease(默认)慢快慢 / ease-in低速开始 / ease-out低速结束 / ease-in-out始末低速 / steps()阶跃函数 / cubic-bezier( )贝塞尔曲线
54.-webkit-filter滤镜grayscale(0~1)灰度
55.-webkit-touch-callout:none 禁用系统默认菜单
-webkit-text-size-adjust:none 字体缩放设置
56.word-wrap长单词换行:normal只在允许的断字点换行 / break-word在长单词或 URL 地址内部进行换行
57.word-break规定自动换行的处理方法:normal / break-all允许在单词内换行 / keep-all只能在半角空格或连字符处换行 参考:https://www.cnblogs.com/dfyg-xiaoxiao/p/9640422.html