1. height 设置高度
height:20px;
2. width 设置宽度
width:20px;
3. line-height 设置行高
line-height:20px;
4. color 设置文字颜色
color:red;
5. font-size 设置文字大小
font-size:20px;
6. font-wight 设置文字粗细
font-wight:bold;
7. font-family 设置文字字体
font-family:"Times New Roman";
8. font-stretch 设置文字斜体
font-stretch:expanded;
9. letter-spacing 设置文字字间距
letter-spacing:2px;
10. text-align 文字居中
text-align:center;
11. display 设置标签是行元素还是块元素
display:inline; //行元素
display:block; //块元素
display:inline-block //行间块元素
display:none //元素消失
12. background 设置背景图片
- image 设置背景图片 background-image:url("")
background-image:url("");
background-color:#fff
background-repeat:no-repeat; //不重复
background-repeat:repeat; //重复
background-position-x:0px
-x 设置x轴位置 center为居中
-y 设置y轴位置 center为居中
background-position:center 同时xy都居中
background-size:80px 90px;
// 如果两个参数 第一个是宽 第二个是高
//如果有一个参数即为 宽高
13. 颜色的三种写法
十六进制 #rrggbb rr红色 gg绿色 bb蓝色
颜色的英文单词
RGB rgb(0,0,0)~rgb(255,255,255) (rgba a取值范围 0~1 透明度)
14. boder 设置元素边框
1. -left -top -right -bottom
2. 复合型写法 boder:1px solid red;
3. solid 实线
4. dashed 虚线
5. dotted 点状线
6. none 无边框
7. double 双实线
15.margin 外边距
1. -left -top -right -bottom
2. margin:10px; 四条同时设置
3. margin:10px 15px; 第一个上下 第二个左右
4. margin:10px 15px 20px;第一个上 第二个左右 第三个下
5. margin:10px 15px 20px 25px;上右下左
6. margin(0,auto)上下为0,左右居中
只能使块元素居中,行元素不能使用
外边距计算方法:
块标签:相邻盒子间 如果设置
16. padding 内边距
1. -left -top -right -bottom
2. padding:10px; 四条同时设置
3. padding:10px 15px; 第一个上下 第二个左右
4. padding:10px 15px 20px;第一个上 第二个左右 第三个下
5. padding:10px 15px 20px 25px;上右下左
17. text-align 设置文字或行元素排列方式
1. center 居中
2. left 左对齐
3. right 右对齐
18. vertical-algin 设置纵向排列方式
1. top 以顶部基准对齐
2. bottom 以底部基准对齐
3. sub 文字下标
4. super 文字上标
5. baseline 默认
6. middle 以中心为基准
7. 数值 正值偏上 负值偏下
8. 百分比
19.transition: 事件属性 特效更加柔和 0.5s
transition:0.7s;
20.超出隐藏
overflow:hidden;
21.box-shadow:设置阴影五个参数
box-shadow:2px 3px 5px 5px;
参数1:设置水平阴影位置 以0为基准 大于0 阴影向右偏移
参数2:设置垂直阴影位置 以0位基准 大于0 阴影向下偏移 反之向上
参数3:设置模糊度
参数4:设置阴影大小
参数5:设置内外阴影 加上inset是内阴影 不加是外阴影
22.text-shadow: h-shadow v-shadow blur color;
text-shadow: 5px 5px 5px red;
参数1:必需。水平阴影的位置。允许负值。
参数2:必需。垂直阴影的位置。允许负值。
参数3:可选。透明度。
参数4:可选。颜色。
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。