CSS单词梳理
CSS的核心知识: 定位 + 布局 + 盒子模型 + 背景 + 字体 + 动画
1.定位 positioning
2.布局(layout)
3. 盒子模型
1.尺寸(Dimension)
2.外补白(margin)
3.内补白(padding)
4.边框(border)
4.背景(background)
5.颜色(color)
6.字体(font)
7.文本(text)
8.文本装饰(text decoration)
9.列表(list)
10.用户界面(user Interface)
11.变换(transform)
12.过渡(transition)
13.动画(animation)
CSS单词梳理
CSS的核心知识: 定位 + 布局 + 盒子模型 + 背景 + 字体 + 动画
1.定位 positioning
position: absolute; 绝对定位
position:relative; 相对定位
position:fixed; 固定定位
position: static 正常文档流(没有定位)
top 居上
bottom 居下
left 居左
right 居右
z-index 改变层级 值越大 越在上面
2.布局(layout)
display: inline 行内/内联元素
display:block 块级元素 / 让元素显示
display: inline-block 行内块元素
display:none 让元素隐藏/消失
float:left 左浮动(靠左显示)
float:right 右浮动(靠右显示)
float:none 不浮动(正常的文档流)
clear: left 不允许左边有浮动对象(清除左边的浮动)
clear:right 不允许右边有浮动对象(清除右边的浮动)
clear:both 不允许左右两边有浮动对象(清除左右两边的浮动)
clear: none 允许左右两边有浮动对象
visibility: hidden 让所有可见性的元素隐藏
visibility: visible 让所有可见性的元素显示
overflow:hidden 溢出隐藏/清除浮动/解决margin-top的传递问题
overflow-x:hidden 水平方向隐藏
overflow-y:hidden 垂直方向隐藏
overflow-x:scroll 水平方向出现滚动条
overflow-y:scroll 垂直方向出现滚动条
overflow: auto 隐藏方式为自动
3. 盒子模型
1.尺寸(Dimension)
width 宽度
min-width 最小宽度
max-width 最大宽度
height 高度
min-height 最小高度
max-height 最大高度
2.外补白(margin)
margin: 上 右 下 左(遵循顺时针的方向);
margin-top 上外边距
margin-bottom 下外边距
margin-left 左外边距
margin-right 右外边距
3.内补白(padding)
padding: 上 右 下 左(遵循顺时针的方向)
padding-top 上内边距
padding-bottom 下内边距
padding-left 左内边距
padding-right 右内边距
4.边框(border)
border 复合属性,四个方向边框线
border-width 边框线的宽度
border-style 边框线的类型(solid 实线 dashed 虚线 dotted 点状线)
border-color 边框线的颜色
border-top 上边框线
border-bottom 下边框线
border-left 左边框线
border-right 右边框线
border-radius: 上左 上右 下右 下左; 圆角(50% 可以把正方形或者长方形变成圆形)
box-shadow 盒子的阴影
4.背景(background)
background 背景的复合属性(简写)
background-color 背景颜色
background-image 背景图片
background-repeat 背景平铺(重复)方式
background-attachment 背景随着滚动条是滚动还是固定
background-position: x轴 y轴; 背景定位(雪碧图的重要属性)
background-origin 背景显示的左边原点
background-clip 背景裁剪的方式
background-size 背景尺寸
5.颜色(color)
color 字体颜色
opacity 透明度 取值范围【0-1】
6.字体(font)
font 字体的复合属性(简写)
font-size: 字体大小
font-weight 字体粗细
font-style 字体样式(斜体/正常)
font-family 字体类型(黑体 宋体等)
7.文本(text)
white-space:nowrap 禁止文字折行(出现省略必备的条件之一)
text-align:left 文字居左对齐
text-align:center 文字居中对齐
text-align:right 文字居右对齐
letter-spacing 文字与文字的左右间距
line-height 文字与文字的上下间距
text-indent 缩短缩进 -9999px 会让文字消失在页面中
vertical-align 基线对齐
8.文本装饰(text decoration)
text-decoration:none 去掉a的下划线
text-decoration: underline 增加下划线
text-shadow 文字阴影
9.列表(list)
list-style:none 去掉li前面默认的小黑点或者数字
10.用户界面(user Interface)
text-overflow:elipsis 文本以省略号的方式隐藏(出现省略号必备的条件之一)
cursor: pointer 让鼠标变成小手的形状
zoom:1 检索对象的缩放比例
box-sizing IE怪异盒模型
11.变换(transform)
transform:translateX(10px) x轴(水平方向)移动10px
transform: translateY(10px) y轴(垂直方向)移动10px
transform: translate(10px,10px) x和y轴同时移动10px
transform: scale(2) 把元素放大2被
transform: rotate(90deg) 把元素旋转90度
12.过渡(transition)
transition 过渡简写
transtiton-property 过渡动画的属性名称
transition-duration 过渡动画的持续时间
transition-timing-function 过渡动画的运动曲线 ease 默认值:匀速
transition-delay 过渡动画的延迟时间
13.动画(animation)
animation 动画的简写
animation-name 动画的名称
animation-duration 动画的持续时间
animation-timing-function 动画的运动曲线
animation-delay 动画的延迟时间
animation-iteration-count 动画的运动曲线 (infinite 无限次)
animation-direction 动画运动的方向
animation-play-state 动画运动的状态 playing 运动 pasued 暂停
animation-fill-mode 动画结束时保持的状态