基础英语
1.宽和高
-
width: ; 设置宽
-
height: ;设置高
2.外边距 内边距
-
margin: ; 设置外边距(top,right,bottom,left)
-
padding: ; 设置内边距(top,right,bottom,left)
3.字体设置
- font-size: ; 设置字体大小
- font-weight: ; 设置字体粗细
- color: ; 设置字体颜色
- letter-spacing:2px; 设置字间距
- 可设置的属性是(按顺序): “font-style font-variant font-weight font-size/line-height font-family”
- font-size和font-family的值是必需的。如果缺少了其他值,默认值将被插入,如果有默认值的话。
- letter-spacing: 2px; 设置字间距
4.表格属性
- border: ; 设置表格的边框(默认border=“0” 无边框)
- cellspacing: ; 设置单元格与单元格边框之间的空白间距
- cellpadding: ;设置单元格内容与单元格边框之间的空白间距
- width: ; 设置表格的宽度
- height: ; 设置表格的高度
- align: ; 设置表格再网页中的水平对齐方式
- caption: ; 表格标题标签
- rowspan=“合并单元格的个数”
- colspan=“合并单元格的个数”
5.a标签伪类选择器
- a:link /* 未访问的链接 */
- a:visited /* 已访问的链接 */
- a:hover /* 鼠标移动到链接上 */
- a:active /* 选定的链接 */
6.行内、块级、行内块
- display:inline; 块转行内
- display:block; 行内转块
- display:inline-block; 块、行内元素转换为行内块
7.行高,文字居中,div居中
- line-height: ; 设置行高
- margin: 0 auto; div居中
- text-align: center; 文字水平居中
- text-indent: 2em; 首行缩进
- text-decoration: none || underline || overline || line-through 文本的装饰
值 | 描述 |
---|---|
none | 默认。定义标准的文本。取消下划线(最常用) |
underline | 定义文本的一条线。下划线 也是我们链接自带的(常用) |
overline | 定义文本上的一条线。(不用) |
line-through | 定义穿过文本下的一条线。(不常用) |
8.背景设置
- background-color: ; 设置背景颜色
- background-image: none | url; 引入图片
- background-repeat: repeat | no-repeat |repeat-x | repeat-y
- 背景图像在纵向和横向上平铺(默认的)| 背景图像不平铺 | 背景图像在横向上平铺 | 背景图像在纵向平铺
- background-position:length || length ; position || position
- 百分数 | 由浮点数和单位标识符组成的成长值 ;top | center | bottom | left | center | right 方位词
- background-attachment:scroll | fixed 背景图像是随对象内容滚动 | 背景图像固定
- background: transparent url(image.jpg) repeat-y scroll center top;
- background: rgba(0,0,0,0.3);背景透明
9.定位
- position: relative; 相对定位
- position: absolute; 绝对定位
10.边框样式
- none:没有边框(忽略所有边框的宽度p[默认值])
- solid:单实线(常用)
- dashed:虚线
- dotted:点线
- dashed:长方形线
- double:双线边框
- groove:3D凹槽
- ridge:菱形边框
- inset:3D凹边
- outset:3D凸边
11.vertical-align 属性设置元素的垂直对齐方式。
问 | 答 |
---|---|
默认值 | baseline |
继承性: | no |
版本: | CSS1 |
JavaScript 语法: | object.style.verticalAlign=“bottom” |
可能的值
值 | 描述 |
---|---|
baseline | 默认。元素放置在父元素的基线上 |
sub | 垂直对齐文本的下标 |
super | 垂直对齐文本的上标 |
top | 把元素的顶端与行中最高元素的顶端对齐 |
text-top | 把元素的顶端与父元素字体的顶端对齐 |
middle | 把元素放置在父元素的中部 |
bottom | 把元素的顶端与行中最低的元素的顶端对齐 |
text-bottom | 把元素的底端与父元素字体的底端对齐 |
length | |
% | 使用"line-height"属性的百分比值来排列此元素。允许使用负值。 |
inherit | 规定应该从父元素继承 vertical-align 属性的值 |