css中的font属性

  • 1)font-style 设置字体斜体
    font-style:normal | italic | oblique
    1,normal:
    指定文本字体样式为正常的字体
    2,italic:常用
    指定文本字体样式为斜体。对于没有斜体变量的特殊字体,将应用oblique
    3,oblique:
    指定文本字体样式为倾斜的字体
  • 2)在consol中输入escape("宋体")就会出现宋体的unicode码
css中的font属性_第1张图片
Paste_Image.png
  • 3)字体与英文名称转换表
css中的font属性_第2张图片
Paste_Image.png
  • 4)font-family 设置字体
    可以设置多个值
    如果对方没有第一种字体,就匹配第二种字体
   font-family: "SimSun","宋体","微软雅黑";
  • 5)font-weight 设置字体加粗
    1,直接设置数字 推荐这种
    2,bold 效果类似700-900之间(不推荐使用
    3,normal 文字正常显示

     font-weight: 400;
    
  • 6)font属性连写
    1,必须要有font-size和font-family
    2,并且font-size和font-family顺序不能替换
    下面两种情况一样

   font: italic 700 30px 宋体;
   font: 700 italic 30px 宋体;
  • 7)margin设置盒子居中
 .box{
        margin: 0 auto;
        width: 500px;
    }

你可能感兴趣的:(css中的font属性)