Css属性
1. Background-color 背景颜色 可采用#FFFFFF(十六进制),RGB,还有颜色单词
2. Background-image:url (”图片”);
3. Background-repeat:图片重复;no-repeat:不重复;repeat-x,repeat-y:水平或垂直重复
4. Background-attachment:fixed(固定);scroll()
5. background-position: left(水平) top(垂直);
6. 水平:left center right;垂直:top middle bottom 【center代表居中】
7. 简写方法:background:#000url(xxx.gif/jpg/png) repeat fixed left top; background:url("google.jpg") no-repeat scroll bottom;
字体属性
1. 大小:<fontsize></font> 单位:px,pd
2. 样式:font-style: oblique;(偏斜体) 、italic;(斜体) 、normal;(正常)
3. 行高:line-height: normal;(正常) 单位:PX、PD、EM;
4. 【组合在一起,实现文本垂直居中】height: 40px;/*测试attachment是请务必修改高度*/line-height: 40px;
5. 粗细:font-weight: bold;(粗体) 、lighter;(细体) 、normal;(正常)
6. 变体:font-variant: small-caps;(小型大写字母) 、normal;(正常)
7. 大小写:text-transform:capitalize;(首字母大写) 、uppercase;(大写) 、lowercase;(小写) 、none;(无)
8. 修饰:text-decoration: underline;(下划线) 、overline;(上划线) 、line-through;(删除线) 、blink;(闪烁)
9. 常用字体:(font-family):“Courier New”, Courier, monospace, “Times New Roman”, Times, serif,Arial, Helvetica, sans-serif, Verdana
区块属性
1. 字间距:letter-spacing: normal; 数值
2. 对齐:text-align: justify;(两端对齐) left;(左对齐) right;(右对齐) center;(居中)
3. 缩进:text-indent: 数值px;text-indent: 2em; text-indent: 20px;
4. 垂直对齐:vertical-align: baseline;(基线) sub;(下标) super;(上标)top; text-top; middle; bottom; text-bottom;
5. 词间距:word-spacing: normal; 数值
6. 空格:white-space: pre;(保留) nowrap;(不换行)--<pre></pre>
7. 显示:display:block;(块) inline;(内嵌) list-item;(列表项) run-in;(追加部分) compact;(紧凑) marker;(标记) table; inline-table;table-raw-group; table-header-group; table-footer-group; table-raw;table-column-group; table-column; table-cell; table-caption;(表格标题);
方框属性
1. width:; height:; float:;clear:both; margin:; padding:;顺序:上右下左;
边框属性
2. border-style: dotted;(点线) dashed;(虚线) solid(实线); double;(双线) groove;(槽线) ridge;(脊状) inset;(凹陷) outset;
3. border-width:; 边框宽度
4. border-color:#;
5. 简写方法:border:width style color;
6. Border:1px solid red
列表属性
1. 类型:list-style-type:disc;(圆点) 、circle;(圆圈) 、square;(方块) 、decimal;(数字) 、lower-roman;(小罗码数字) upper-roman; (大罗马数字) 、lower-alpha; (小写英文字母)、upper-alpha; (大写英文字母)
2. 位置:list-style-position:outside;(外) inside;
CSS文字属性
1. color : #999999; /文字颜色/
2. text-decoration:underline; /加下划线/
3. text-align:center; /文字居中对齐/
4. vertical-align:top;
5. top 把元素的顶端与行中最高元素的顶端对齐
6. bottom 把元素的顶端与行中最低的元素的顶端对齐。
7. 图像:list-style-image:url(xxx.gif/jpg/png);
CSS链接属性
1. a:link /超链接文字格式/
2. a:visited /浏览过的链接文字格式/
3. a:hover /鼠标转到链接/
4. a:active /按下链接的格式/
鼠标光标样式
1. cursor:hand;(pointer)小手
2. cursor:move;拖拽
3. cursor:crosshair;十字
4. cursor:wait;
5. cursor:text;
6. cursor:help;
盒子模型组成
1. 内容+填充+边框+外边距Content+padding+border+margin
2. Padding-top
3. Padding:内容和边框的距离
4. Margin:盒子和盒子之间的距离
盒子的css属性
/*padding-top: 20px;
padding-left: 5px;
padding-right: 10px;
padding-bottom: 15px;*/
等价的padding:20px 10px 15px 5px; 顺时针 :上、右、下、左
padding:20px 10px; 上下20px;左右10px;
padding:20px 10px 5px; :上:20 左右 :10 下:5
padding:20px 10px -- 10px 5px;【重复中间一个值】
【上下盒子最终距离取最大的margin-top或margin-bottom】
12 3
答案:
A:15 2
B:12 2---------------------------对
C:9 2
【左右最终距离去margin-right或margin-left之和】
答案:
A:15 1---------------------------对
B:12 4
C:9 1
margin:0 auto; 上下是0 左右居中
单一关键字 | 等价的关键字 |
center | center center |
top | center top |
bottom | center bottom |
right | right center |
left | left center |