有没有办法从HTML,CSS或MSHTML接口引用Internet Explorer中的系统字体和颜色?

Dan*_*ski 4 html css internet-explorer mshtml

我想做这样的事情:

<style type="text/css">
  body {
    font-family: dialog-font;  /* Tahoma, Segoe UI or MS Sans Serif */
    color: button-text; 
    background-color: button-face;
  }
</style>
Run Code Online (Sandbox Code Playgroud)

是否有任何特定于Microsoft的CSS值提供此功能?

jay*_*won 7

是的,您可以在CSS中引用系统属性.我知道这适用于颜色,不确定字体.

只需要像这样引用:

    <style type="text/css">
      body {
         font-family: InfoText;  /* Tahoma, Segoe UI or MS Sans Serif */
         color: ButtonText; 
         background-color: ButtonFace;
      }
   </style>
Run Code Online (Sandbox Code Playgroud)

编辑:稍微考虑一下,我认为这也适用于字体,但不是你用对话框字体引用它的方式.您将只引用系统属性,与其他两个相同,并将引用为该属性定义的字体.

第二次编辑:这是一个博客,其中包含可用属性列表,以及比字体更多的信息:

如何在CSS中使用操作系统样式

  • 这是一个很棒的功能,但也为shysters做旧的"安全扫描.你的计算机被感染了.点击这里安装反病毒软件"骗局开启了无数新的可能性.Brrrr. (2认同)