文本样式

2017-11-10  本文已影响0人  霜之朝

font-family:这是文本字体。

字体匹配算法

  1. 浏览器先获取一个系统字体列表
  2. 对元素的每一个字符,使用font-family属性及其他属性进行匹配,如果能匹配就暂定该字体
  3. 如果步骤2没有匹配上,选择下一个可选的font-family执行步骤2
  4. 如果匹配到一个字体,但是字体中没有该字符,继续对下一个可选的font-family执行步骤2
  5. 如果没有匹配到字体,使用浏览器默认字体

font-family使用:


font-size: 文本大小,可以使用px,百分比等作为单位。


font-style


font-weight


line-height


Web Fonts
使用网络上或者本地自定义的字体。使用方法如下:

    @font-face {
      font-family: 'fontname';
      src: url('../fonts/webfont.eot');
      src: url('../fonts/webfont.eot?#iefix') format('embedded-opentype'),
     url('../fonts/webfont.woff') format('woff'),
     url('../fonts/webfont.ttf') format('truetype'),
     url('../fonts/webfont.svg#NeuesBauenDemo') format('svg');
      font-weight: normal;
      font-style: normal;
    }
    div {
      font-family: 'fontname'
    }

text-align


letter-spacing

word-spacing

text-indent

text-decoration

white-space

上一篇 下一篇

猜你喜欢

热点阅读