美文网首页
Chapter 8 字体和颜色样式

Chapter 8 字体和颜色样式

作者: Smnag | 来源:发表于2019-03-13 23:21 被阅读0次
字体 font-family
  • body {font-family: Verdana, Geneva, Arial, sans-serif; }
    首选字体依次排序,最后放通用字体系列名
  • 为页面增加Web字体,将@font-face规则置于body规则之上
@font-face {  
        font-family: "fontname" 
        src: url("http://.......woff")
        src: url("http://.......ttf")
}

web字体托管网站:www.fontsquirrel.comwww.google.com/webfonts

大小 font-size

1、选择一个关键字(推荐small或medium),指定作为body规则中的字体大小,这相当于页面的默认字体大小。
2、使用em或百分数,指定其它元素字体相对于body字体的大小。1.2em=120%
xx-small x-small small(12px) medium large x-large xx-large 依次递增20%

行间距 line-height

line-height:1.6em 即行间距为字体大小的1.6em

颜色 color

表示颜色的四种方法
1、指定名称,只支持150种,如blue、red
2、rgb(80%, 40%, 0%),指红绿蓝分别占80%、40%、0%
3、rgb(204, 102, 0)含义同上,25580%=204
4、rgb(#cc6600)是16进制表示法,cc=12
16+12=204、66=6*16+6=102

粗细 font-weight

值可以为:lighter、normal、bold、bolder或者100-900的整数

风格 font-style

斜体 font-style: italic几乎等于font-style: oblique

划线 text-decoration

underline、overline、line-through(也可在html中使用<del>和<ins>)

相关文章

网友评论

      本文标题:Chapter 8 字体和颜色样式

      本文链接:https://www.haomeiwen.com/subject/shbxmqtx.html