css基础-Background&Text

css基础-Background&Text

    以下笔记为复习css的一些基础,每一节我都做了一个简单的总结事例,以便参考:

 1 /*CSS 属性定义背影效果:
 2 
 3     background-color 定义了元素的背景颜色.
 4     background-image 定义了元素的背景图像.
 5     background-repeat 定义是否重复
 6     background-attachment 背景图像是否固定或者随着页面的其余部分滚动
 7     background-position  改变图像在背景中的位置
 8 */
 9 
10 body{
11    width:200px;
12    height:200px;
13    background-color:#b0c4de;
14    background-image:url(img.png);
15    background-repeat:no-repeat;/*repeat-x,repeat-y*/
16    background-attachment:fixed;/*固定不动*/
17    /*scroll     背景图片随页面的其余部分滚动。这是默认
18      fixed     背景图像是固定的
19      inherit     指定background-attachment的设置应该从父元素继承*/
20    background-position:top center;
21 
22 }
23 
24 /*简写*/
25 body{
26     width:200px;
27     height:200px;
28     background:url(img,png) no-repeat fixed top center;
29 }
30 
31 
32 /*文本格式
33 text-align:center left rifht justify(左右对齐);
34 text-decoration:none  overline(上边一横线)  line-through(中间一横线) underline;
35 文本转换
36    text-transform:uppercase(全为大写) lowercase(全为小写) capitalize(每个字的首字母大写);
37 文本缩进
38    text-indent:50px;首行缩进50px
39 字间距
40    word-spacing:30px;
41 文字方向
42   direction:ltr;  left to right
43 字母间距
44  letter-spacing:1px;
45  行高
46   line-height:30px;
47 */
48 p{
49     width:200px;
50     height:300px;
51     margin:0;
52     padding:0;
53     text-align: center;
54     text-decoration: underline;
55     text-indent: 10px;
56     word-spacing: 5px;
57     letter-spacing:2px;
58     line-height: 20px;
59     direction: ltr;
60     text-transform: capitalize;
61 }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。