⬆️ ⬇️

How to use operating system styles in CSS

In CSS 2.1, there was one interesting feature that not everyone knows about - the ability to set fonts and colors on a web page that are used in the current system theme of the operating system.

This can be useful in situations where you want to bring your page interface closer to the user interface of the operating system. For example, you want to write an Adobe AIR application, or make a help interface, like a native chm-help (like this: manual.pohape.ru ).



In fact, everything is very simple and without any magic. We will use standard css-properties with slightly non-standard values.



System fonts



System fonts are set with the usual font property with only one parameter — the font type. Of course, the type of style, size and other attributes are already contained within this parameter.



Example of use:

')

.menu

{

font : menu;

}





Complete table of all available values:

ValueDescription
captionFont on controls (buttons, radio, drop-down lists)
iconFont for icons
menuFont used in system menus
message-boxDialog Font
status-barFont in the status bar


System colors



System colors can be assigned to any property that supports the color value.



Example of use:



.dialog

{

color: WindowText;

background-color: Window;

}




Complete table of all available values:

ValueDescription
ActiveBorderThe color of the active window frame
ActiveCaptionActive window title color
AppworkspaceBackground color in MDI applications
BackgroundDesktop Background
ButtonfaceThe color of the front surface for 3d-elements (for example, buttons)
ButtonHighlightThe color of the shadow in the 3d-elements in the position of "face from the light"
ButtonShadowShadow color for 3d elements
ButtonTextText at the pressed button
CaptionTextLabel text color
GraytextInactive (locked) text color
HighlightThe color of the selected menu item
HighlighttextThe color of the text inside the element under the selection
InactiveBorderInactive window frame
InactivecaptionInactive window caption color
InactiveCaptionTextText inside an inactive window title
InfobackgroundBackground color for tooltips (tooltips)
InfoTextText inside tooltips
MenuBackground color of menu items
MenuTextText color inside the menu
ScrollbarColor scrollbar
WindowWindows background color
Windowframexs;) (may prompt in the comments)
WindowtextText inside windows

Source: https://habr.com/ru/post/68699/



All Articles