CSS(一)字体样式属性

CSS字体样式属性

一)字体

1.font-size

推荐使用相对长度像素单位px

2.font-family:

* {
        font-family: Arial, '幼圆';
    }

浏览去从前往后查找字体。

3.font-weight:加粗,建议直接用数字

a {
        font-weight: bold; <!--等于700-->
    }
    h1 {
        font-weight: 400; /*等于normal*/
    }

4.font-style: 倾斜否 normal italic

5.字体连写:

font: {font-style font-weight font-size/line-height font-family}

不要的可以省略,但是font-size和font-family不能省略

6.line-height:行间距,一般使用px,通常比字号大7~8px,行高等于盒子高度可以让其内文字垂直居中。

二)颜色

color

1)预定义:red,green,blue

2)十六进制:如#FF0000,一次为红绿蓝占比

3)RGB:如红色rgb(255,0,0)或rgb(100%,0,0)

三)其他相关

1.text-align: 设置文本内容的水平对齐方式,left、right、center

2.text-intent: 首行速进几个字符  单位:em(几个字符)

3.text-decoration: none|underline|blink|overline|line-through

原文地址:https://www.cnblogs.com/Shadowplay/p/10994529.html