开发者

CSS System colors: is there a mapping for different browsers/operating system parameter?

According to the CSS spec, there are a number of built-in system colors that can be used, things like Highlight and Background.

Is there any mapping between these build-ins and the various OS/Browser settings?

For example, if I use color: H开发者_如何学Cighlight in my CSS on WinXP, what do I have to change in my Display Properties -> Appearance in order to change the default?


Most if not all the settings map to the Window Colour and Appearance settings. The names do not all match though, for example in CSS Background equals Desktop. This is a good page for testing, change some settings in your system them refresh the page.

EDIT: Highlight equals Selected Items in system preferences. I'd use the ::selection selectors mentioned below to control this for none IE browsers.

Why do you want to be able to do this? If it's on your own computer then only you will see the colours that you select - you may as well just add them to the CSS, and if it's for a kiosk/public machine I'd code the correct colours I want as someone changing the system preferences would alter the site.

You can change how selected text looks to all users, however I think this only works in Firefox / Webkit browsers, so no IE.

::-moz-selection{ background: #666; color:#fff; } ::selection { background:#666; color:#fff; }

This'll make selected text be white on a dark grey background.

More useful links: http://www.iangraham.org/books/xhtml1/appd/update-23feb2000.html and https://developer.mozilla.org/en-US/docs/Web/CSS/color_value - scroll down to system colours

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜