Preventing high-contrast mode in Edge from adding background to text

馋奶兔 提交于 2019-12-10 10:51:41

问题


I'm working to adjust some components so that they all function and look good in high-contrast mode. Edge seems to be adding a black background under all text that IE11 does not add. I can't seem to find a way to target this background in CSS, or any other way to normalize the behavior between the two browsers.

For example, let's say I have the following:

<div class="SelectedText">
  Text!
</div>

And let's say I assigned background-color: cyan; and color: black; to the .SelectedText div.

In this scenario, IE11 renders it as expected with the div and text having the assigned colors. However, in Edge the div background and text are given the right colors, but the text itself gets a black background drawn behind it, making it unreadable black on black text.

The following image illustrates this problem occurring in the context of menu items with with basically the same markup described above.

Is there any way to disable or target this extra background that Edge adds?


回答1:


Found the answer to this eventually. Setting -ms-high-contrast-adjust: none; on the parent can disable the backgrounds that Edge puts behind text.



来源:https://stackoverflow.com/questions/45805775/preventing-high-contrast-mode-in-edge-from-adding-background-to-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!