scss Sass font-face mixin

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss Sass font-face mixin相关的知识,希望对你有一定的参考价值。

@mixin fontFace($family, $src, $style: normal, $weight: normal) {
	@font-face {
		font-family: $family;
		src: url('#{$src}.eot'); // IE9 compat
		src: url('#{$src}.eot?#iefix') format('embedded-opentype'), // IE8 and below
			url('#{$src}.woff') format('woff'), // standards
			url('#{$src}.ttf') format('truetype'), // Safari, Android, iOS
			url('#{$src}.svg##{$family}') format('svg'); // legacy iOS

		font-style: $style;
		font-weight: $weight;
	}
}
/*
$style-name being the name of the font e.g. Helvetica
$file meaning the file name, without the file extensions
$family being the folder inside the fonts folder where the font files are
$category is serif or sans-serif or monospace etc. as a fall back in CSS
*/

// real example
@include fontFace('bnb', '/fonts/bebas_neue_bold');

以上是关于scss Sass font-face mixin的主要内容,如果未能解决你的问题,请参考以下文章

scss SASS @ font-face mixin

scss SASS @ font-face mixin

scss Sass font-face mixin

scss SASS @ font-face mixin

scss Sass partial:@ font-face mixin

scss Sass mixin包含font-face的字体