scss SASS变量列表,用于帮助管理数字CSS字体粗细值。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss SASS变量列表,用于帮助管理数字CSS字体粗细值。相关的知识,希望对你有一定的参考价值。

// Weights
$hairline-weight: 100;
$thin-weight:     200;
$light-weight:    300;
$normal-weight:   400;
$medium-weight:   500;
$semibold-weight: 600;
$bold-weight:     700;
$xbold-weight:    800;
$black-weight:    900;

// Synonyms
$regular-weight:    $normal-weight;
$book-weight:       $light-weight;
$xlight-weight:     $hairline-weight;
$ultralight-weight: $hairline-weight;
$heavy-weight:      $xbold-weight;

// Include fonts
// Order matters: normal, bold, italic, bold+italic

@font-face {
  font-family: "MyFont";
  font-weight: $normal-weight;
  font-style: normal;
  src: url("#{$fonts-path}/MyFont-Regular.eot");
  // and the rest of the src urls...
}

@font-face {
  font-family: "MyFont";
  font-weight: $medium-weight;
  font-style: normal;
  src: url("#{$fonts-path}/MyFont-Medium.eot");
  // and the rest of the src urls...
}

@font-face {
  font-family: "MyFont";
  font-weight: $bold-weight;
  font-style: normal;
  src: url("#{$fonts-path}/MyFont-Bold.eot");
  // and the rest of the src urls...
}


@font-face {
  font-family: "MyFont";
  font-weight: $normal-weight;
  font-style: italic;
  src: url("#{$fonts-path}/MyFont-Italic.eot");
  // and the rest of the src urls...
}

@font-face {
  font-family: "MyFont";
  font-weight: $medium-weight;
  font-style: italic;
  src: url("#{$fonts-path}/MyFont-Medium-Italic.eot");
  // and the rest of the src urls...
}

@font-face {
  font-family: "MyFont";
  font-weight: $bold-weight;
  font-style: italic;
  src: url("#{$fonts-path}/MyFont-Bold-Italic.eot");
  // and the rest of the src urls...
}

// Use 'em

body {
  font-family: "MyFont", sans-serif;
}

p {
  font-weight: $normal-weight;
}

em {
  font-style: italic;
}

strong {
  font-weight: $bold-weight;
}

以上是关于scss SASS变量列表,用于帮助管理数字CSS字体粗细值。的主要内容,如果未能解决你的问题,请参考以下文章

scss SASS颜色函数和CSS变量

scss Sass Css字体堆栈变量

scss Sass Css字体堆栈变量

scss Sass Css字体堆栈变量

scss 用于CSS3动画的Sass Mixin

scss 用于CSS3动画的Sass Mixin