Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@font face 规则 #27

Open
yangsirgo opened this issue Nov 17, 2019 · 0 comments
Open

@font face 规则 #27

yangsirgo opened this issue Nov 17, 2019 · 0 comments

Comments

@yangsirgo
Copy link
Owner

yangsirgo commented Nov 17, 2019

@font-face { font-family: 'Microsoft Yahei'; src: url(example.ttf); }
font-family 可以看成字体变量,名称可以随意,但是如果设置成系统的字体名称,比如微软雅黑字体 更改为 example.ttf 对应字体了

src

src属性跟 img 的src 属性一致,引入本地或者外链字体,使用系统安装字体,使用local()功能符号(兼容IE9+),外链字体使用url()功能符。
业界使用自定义字体的格式:
格式如下

eot,woff,ttf,svg是字体的格式,多个url 为了浏览器兼容做的处理。
自定义字体使用:

.iconfont {
  font-family: "ICON" !important;
}

[class*=" el-icon-"], [class^=el-icon-] {
    font-family: element-icons!important;
}

css属性选择器:
[attr^=value]
表示带有以 attr 命名的属性,且属性值是以"value"开头的元素。
[attr$=value]
表示带有以 attr 命名的属性,且属性值是以"value"结尾的元素。
[attr*=value]
表示带有以 attr 命名的属性,且属性值包含有"value"的元素。
再也不用写 iconfont iconshanchu 两个class 名称,写一个就好。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant