CSS

来源:互联网 发布:郑州八度网络怎么样 编辑:程序博客网 时间:2024/06/03 19:47

1 文本属性

  1. font-style:斜体,可区分中/英文设置。
  2. font-family:字体。一组字体候选列表,供浏览器查找使用。
  3. font-size:字体大小。px/%/em。
  4. text-decoration:字体线。可多选属性:
    • line-through:删除线
    • underline:下划线
    • overline:上划线
    • none(default):无。

多属性简写:

font: font-style(可选) font-variant(可选) font-weight(可选) font-size/line-height(可选) font-family(逗号分隔多个选项);

1.1 关于font-family

font-family: "Source Code Pro" MicrosoftYaHei sans-serif;
  1. font-family属性值为候选字体或字体系列的列表,最多可使用5个值。
  2. sans-serif系列:没有衬线的字体系列。
  3. 浏览器会按照属性按顺序查找计算机是否已安装字体,若没有则查找下一个,直至结束。
  4. 字体名称区分大小写。

1.2 自定义字体

@font-face{    font-family: "Source Code";  //字体名字,一个单词可省略双引号    src:url('xxx.woff'),        url('xxx.ttf');}

2 文本不换行,超出部分以…显示

 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 210px; //除width属性外,其他属性顺序不能颠倒

3 文本禁止选择

-webkit-touch-callout: none;  /* iOS Safari */-webkit-user-select: none;    /* Chrome/Safari/Opera */-khtml-user-select: none;     /* Konqueror */-moz-user-select: none;       /* Firefox */-ms-user-select: none;        /* Internet Explorer/Edge */user-select: none;            /* Non-prefixed version, currently not supported by any browser */
0 0
原创粉丝点击