有没有办法从 HTML、CSS 或 MSHTML 界面引用 Internet Explorer 中的系统字体和颜色?

发布于 2024-08-19 21:51:41 字数 271 浏览 4 评论 0原文

我想做这样的事情:

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

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

I want to do something like this:

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

Are there any Microsoft-specific CSS values which provide this functionality?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

话少心凉 2024-08-26 21:51:41

是的,您可以在 CSS 中引用系统属性。我知道这对颜色很有效,但不确定字体。

只需要像这样引用:

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

编辑:再想一想,我认为这也适用于字体,但不是你用 dialog-font 引用它的方式。您只需引用系统属性,与其他两个属性相同,并且将引用为该属性定义的字体。

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

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

Yes, you can reference the system properties in your CSS. I know this works well with colors, not sure about fonts.

Just need to reference like this:

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

EDIT: With a little more thought, I think this will work with fonts as well, but not how you were referencing it with dialog-font. You would just reference the system property, same as the other two, and the font defined for that property will be referenced.

Second EDIT: Here is a blog with the list of available properties, as well as more info than I had on fonts:

How to Use Operating System Styles in CSS

带上头具痛哭 2024-08-26 21:51:41

CSS 只影响浏览器的 HTML 表示部分,而不影响系统部分,所以不。

也许使用某种小程序或 ActiveX 控件可以让您做到这一点,但这有必要吗?

CSS affects only the HTML representation part of the browser and not the system one, so NO.

Maybe using some kind of applet or activeX control will allow you to do this, but is this necessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文