CSS(二)——背景,文本,字体

140 阅读1分钟

背景方面

两种写法

  1. 正常写法
div{
    height:200px;
    width:200px;
    background-color:pink;
    background-image:url("图片的地址")  !!
    <!--!!注意这个背景图片引入的方式(不是单纯的<image>标签)-->
    background-repeat:no-repeat; 不重复
                      x-repeat; x方向重复
                      y-repeat; y方向重复
   background-position: center left right top bottom
                       10%
                       x y如果只写了一个则另一个默认center
}
  1. 背景简写
#container{
      width: 200px;
      height: 200px;
      background: green url('../imgs/logo.png') center no-repeat;
    }

文本

1.文本对齐方式

text-align:center right left

2.首行缩进

text-indent:20px
正的是往右串
负的是网左串
  1. 文本装饰
text-decoration: line-through;
        none 没有
        underline 下划线
        overline
        line-through

字体

1.字体库(每家公司的都不同)

font-family: Times, TimesNR, 'New Century Schoolbook',Georgia, 'New York', serif;
  1. 字体大小
font-size: 
<!--网页主内容区域一般用的都是14px,默认16px,最小支持12px,移动端可以支持小于12px-->
  1. 字体风格
font-style: 
<!-- normal 默认
     italic 斜体
     oblique 倾斜展示-->

4.字体粗细

font-weight:
<!-- 100~900 默认400 bold 加粗 bolder更粗-->