首页 > 解决方案 > 不能将 font-style=italic 与 font-weight 结合使用

问题描述

我不是 css 专家,我在跨浏览器行为方面遇到了一些麻烦。在 Google Chrome 中,我的代码运行良好。在我尝试过的其他浏览器(Mozilla、Edge、IE)中没有;特别是在使用这些最后的浏览器时,font-style 属性似乎排除了 font-weight 属性

这是我的 html 和 css 代码:

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <style>
  .non-italic-class{
    font-size: 25px;
    font-weight: 900;
    font-family: "futura-pt", sans-serif;
  }
  .italic-class{
    font-style: italic;
  }
  </style>

</head>

<body>
  <span class="non-italic-class">NON ITALIC</span>
  <br>
  <span class="non-italic-class italic-class">ITALIC</span>
</body>
</html>

这是它在 Chrome 中的样子(对我来说很好):

在此处输入图像描述

这是它在 Mozilla、Edge、IE 中的样子(对我来说是错误的):

在此处输入图像描述

难道我做错了什么?我是否需要添加一些代码才能在所有这些浏览器中获得相同的行为?

标签: csscross-browser

解决方案


推荐阅读