【问题标题】:How to set the font weight in the font-family property?如何在 font-family 属性中设置字体粗细?
【发布时间】:2018-01-30 14:33:56
【问题描述】:

我有下面的css代码

.mybutton{
font-family : Segoe UI Semibold;
}

半粗体适用于上述情况

我需要改变如下

.mybutton{
font-family: Segoe UI, Helvetica Neue, Arial Semibold
}

但是半粗体不适用,如何在不使用 font-weight 属性的情况下实现这一点

【问题讨论】:

  • font: bold 15px "Segoe UI", Helvetica Neue, Arial;

标签: css


【解决方案1】:

这里是字体的简写

body {
 font: font-style font-variant font-weight font-size/line-height font-
 family;
}

【讨论】:

    【解决方案2】:

    font-family属性中不能设置font-weight,可以设置为font:属性,

    font: font-style font-variant font-weight font-size/line-height font-family|caption|icon|menu|message-box|small-caption|status-bar|initial|inherit;
    

    在你的项目中,

    .mybutton{ font: bold Segoe UI, Helvetica Neue, Arial Semibold; }

    【讨论】:

      【解决方案3】:

      对于字体属性 font-size 和 font-family 是必需的,可以添加其他属性,如果没有给出 font-size 和 font-family 则默认值将被继承

      如果您不想添加 font-weight:bold 则使用粗体字体系列

      .mybutton{
          font: bold 15px Segoe UI, Helvetica Neue, Arial;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-10-23
        • 2016-10-12
        • 2015-04-15
        • 2015-03-28
        • 1970-01-01
        • 1970-01-01
        • 2019-08-19
        • 2013-08-11
        相关资源
        最近更新 更多