开发者

Is there any way to reference the system fonts and colors in Internet Explorer from HTML, CSS or MSHTML interfaces?

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 Microso开发者_如何学编程ft-specific CSS values which provide this functionality?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜