css之常用属性

1.背景(background) 


背景颜色:可以使用 background-color 属性为元素设置背景色。
如:   <body style=“background-color:gray; ”></body>
     或 <body style=“background-color:#CCC; ”></body>


背景图像:
     要把图像放入背景,需要使用 background-image 属性。background-image属性的默认值是 none,表示背景上没有放置任何图像。
    如果需要设置一个背景图像,必须为这个属性设置一个 URL 值:

  简写:.bg-img{background:url(images/a.jpg) no-repeat center  100px 50px;} 

     .bg-img{background-img:url(images/a.jpg);background-repeat:no-repeat;background-position:center;with:100px;height:50px;}

background-repeat:repeat-x----横向平铺

                  repeat-y-----纵向平铺

                  no-repeat----不平铺

background-position: top、bottom、left、right 和 center

  1: 写一个关键字:默认本身居中定位;   比如:top---上居中

  2: 写两个关键字:x y;    比如右下角---right bottom ( 右下角)

  3: 写准确的像素值: x y   比如: 100px 50px----向右边移动100px;向下边移动50px; ( 可以包含负数 )

2.字体(font) font:有固定的顺序:font-style   |   font-variant   |  font-weight  | font-size | line-height | font-family

指定字体
      font-family属性设置具体的字体。
     如:<h3 style=“font-family:Georgia; ”></h3>
字体变形:
      font-variant 属性可以设定小型大写字母。
     小型大写字母不是一般的大写字母,也不是小写字母,这种字母采用不同大小的大写字母。
  如:<h3 style=“ font-variant:small-caps; ”></h3>
字体加粗:
     font-weight 属性设置字体的粗细normal正常的(默认)| bold (粗体 700) | bolder(更粗) | lighter (更细)   
  如:<h3 style=“ font-weight:bold; ”></h3>

字体风格:
       font-style 属性最常用于规定斜体文本。
  该属性有三个值:
  normal - 文本正常显示
  italic - 文本斜体显示
  oblique - 文本倾斜显示
  如: <h3 style=“font-style:italic ”></h3>
字体大小:
      font-size 属性设置字体的大小small(小) | x-small(加小) | xx-small(加加小) | medium | large | x-large | xx-large
   如: <h3 style=“font-size:14px;  ”></h3>

.font{

;

;

;

;

'微软雅黑';}

3.文本(text)

color:文本颜色;

letter-spacing :设置字间距

line-height :行高

text-align :文字对齐方式:左( left)  中( center)  右(right)

text-decoration :文本修饰                         

  ---- underline加下划线 |none无样式| overline上划线| line-through删除线

text-indent:首行缩进----(单位2em;)

text-transform:转换文本             

  ------capitalize  首字母大写 | uppercase 全大写  | lowercase 全小写