zoukankan      html  css  js  c++  java
  • CSS笔记(五)字体

      CSS 字体属性定义文本的字体系列、大小、加粗、风格(如斜体)和变形(如小型大写字母)。

      参考:http://www.w3school.com.cn/css/css_font.asp

      

    • CSS字体系列

    5种通用字体系列:

    ① Serif 字体

    ② Sans-serif 字体

    ③ Monospace 字体

    ④ Cursive 字体

    ⑤ Fantasy 字体

    • 指定字体系类
    p {font-family: Times, TimesNR, 'New Century Schoolbook', Georgia, 'New York', serif;}
    • 字体风格

    常用于规定斜体文本。共三个值:normal,italic和oblique。

    p.normal {font-style:normal;}
    p.italic {font-style:italic;}
    p.oblique {font-style:oblique;}
    • 字体变形

    可设置小型大写字母。

    p.normal {font-variant: normal}
    p.small {font-variant: small-caps}

    使用:

    <p class="normal">This is a test</p>
    <p class="small">This is a test</p>

    效果:

    • 字体加粗

    设置文本的粗细。从100~900为字体指定了9级粗细。400对应normal,而700对应bold。

    p.normal {font-weight:normal;}
    p.thick {font-weight:bold;}
    p.thicker {font-weight:900;}

    使用:

    <p class="normal">This is a test</p>
    <p class="thick">This is a test</p>
    <p class="thicker">This is a test</p>

    效果:

    • 字体大小

    设置文本的字体大小。默认普通的默认大小为16像素(16px = 1em)。在IE中很可能要使用em设置字体大小。

    h1 {font-size:60px;}
    h2 {font-size:2.5em;}
    p {font-size:0.875em;}

    CSS 字体属性

    属性描述
    font 简写属性。作用是把所有针对字体的属性设置在一个声明中。
    font-family 设置字体系列。
    font-size 设置字体的尺寸。
    font-size-adjust 当首选字体不可用时,对替换字体进行智能缩放。(CSS2.1 已删除该属性。)
    font-stretch 对字体进行水平拉伸。(CSS2.1 已删除该属性。)
    font-style 设置字体风格。
    font-variant 以小型大写字体或者正常字体显示文本。
    font-weight 设置字体的粗细。
  • 相关阅读:
    Java类型转换.
    搭建jenkins集群node结点
    java Lambda
    @Autowired使用说明
    Disruptor底层实现讲解与RingBuffer数据结构讲解
    Disruptor并发框架简介
    并发编程中的读写锁分离锁的使用
    并发编程过程中的重入锁
    互联网进行限流策略的Semaphore信号量使用
    并发编程中Future和Callable使用
  • 原文地址:https://www.cnblogs.com/AmitX-moten/p/4846642.html
Copyright © 2011-2022 走看看