css基础
css的属性
color: 设置文本元素的字体颜色
top: 控制元素顶部的位置
text-align: 使用这个元素将文本左对齐,居中或右对齐
letter-spacing: 能够设置字母之间的间距
font-style: 设置斜体文本
list-style: 改变列表中列表项的外观
background-image: 在元素后面放置一个图像
padding: 在元素的边缘和它的内容之间需要有空间,可以使用padding(内边框)
border: 这个属性在一个元素周围加边框,可以有实线边框,凸起边框,虚线边框
font-weight: 控制文本的粗细
background-color: 控制元素的背景颜色
line-height: 设置文本元素的行间距
font-size: 改变文本的大小
left: 指定一个元素左边所在的位置
1.字体类型font-family
sans-serif:无衬线字体; Verdana,Arial Black,Trebuchet MS,Arial,Geneva;
serif:衬线体; Times,Times New Roman,Georgia;
monospace:等宽字体; Courier,Courier New,Andal Mono;
cursive:手写体; Comic Sans,Apple Chancery;
fantasy:范特西; Last Ninja,Impact;
2.字体大小font-size
指定字体大小:
body关键字建议small或medium body中也可以使用%和em
关键字:xx-small,x-small,small,medium,large,x-large,xx-large
3.字体粗细font-weight:bold, normal;
4.字体风格font-style
斜体(ltalic),倾斜(oblique)
5.颜色
背景色background-color
background-color: rgb(80%,40%,0%)=(204,102,0)可以通过百分比调色
三种指定颜色的方法:
{
background-color: rgb(80%, 40%, 0%);
background-color: rgb(204, 102, 0);
background-color: #cc6600;
}
6.文本装饰text-decoration
删除线line-through;
下划线上划线underline overline;
7.下边框{border-bottom: 1.0px solid #888888}
实线solid; 虚线dashed
8.行间距{line-height: 1.6em} 1.6em表示行间距是字体大小的1.6倍