html - CSS 过滤器 : Wikipedia: Inline math's background is not transparent

标签 html css google-chrome-extension filter

前几天,我写了一个用于为维基百科创建深色模式的 Chrome 扩展,玩得很开心。一切顺利,但后来我注意到了一些瑕疵:

Screenshop snippet of artifacts.

对应的html是:

<span class="texhtml">
<i>ω</i>
<span style="position:relative; 
    margin-right:-0.75em; 
    right:0.75em; 
    bottom:0.75em;;">
        <small>→</small>
</span>

... 来自网站:https://en.wikipedia.org/wiki/Vorticity

我找不到此跨度或其中任何其他节点的任何背景 css 设置...当我在我的扩展程序中更改背景设置时,没有任何反应。

这是我的扩展程序加载的 css 文件:

:root                                                                              
{                                                                                  
    /* COLOR DEFINITONS */                                                         

    /* Color palette from hackaday.com */                                          
    --background: rgb(30,30,30);                                                   
    --text: rgb(221,221,221);                                                      
    --border: rgb(72,72,72);                                                       
    --links: rgb(23,168,250);                                                      
}                                                                                  

/* Remove top banner */                                                            
#cnotice-main                                                                      
{                                                                                  
    display: none !important;                                                      
}                                                                                  

/* Borders */                                                                      
*                                                                                  
{                                                                                  
    border-color: var(--border) !important;                                        
}                                                                                  

/* Links */                                                                        
a                                                                                  
{                                                                                  
    color: var(--links) !important;                                                
}                                                                                  

/* Invert Wikipedia Logo */                                                        
#p-logo                                                                            
{                                                                                  
    filter: invert(100%) !important;                                               
}                                                                                  

/* Change colors where appropriate */                                              
body, #content,                                                                    
*[class~='navbox'], td, #simpleSearch,                                             
*[class^='suggestions'], *[class^='special-'], input,                              
#mw-head, table, div[id='catlinks'], div[class^='thumb'],                          
table[class^='wikitable'], th, span[class='tocnumber'],                            
*[id^='p-namespaces'], *[id^='p-view'], span, li,                                  
div[class^='mw-'], *[class^='Nav'],                                                
*[id^='mwe-popup'],                                                                
*[class^='mwe-popup'],                                                             
*[id^='mp-'], div[id='toc'],                                                       
h1, h2, h3, h4, h5, h6                                                             
{                                                                                  
    background-image: none !important;                                             
    background-color: var(--background) !important;                                
    background: var(--background) !important;                                                                                                              
    color: var(--text) !important;                                                 
}                                                                                  

/* DOES NOT WORK, i.e. background is still solid grey. */                          
[class='texhtml']                                                                  
{                                                                                  
    background rgb(0,0,0,0.5) !important;                                          
}                                                                                  

/* Latex formulae */                                                               
.mwe-math-fallback-image-inline                                                    
{                                                                                  
    filter: invert(100%);                                                          
}           

任何帮助将不胜感激!

最佳答案

您可以使用 CSS 为每个跨度设置背景。

您应该从选择器中排除该标签:而不是将背景应用于每个 <span>标记,你应该尝试:

span:not(.texhtml),
span:not(.texhtml) span

关于html - CSS 过滤器 : Wikipedia: Inline math's background is not transparent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53159626/

相关文章:

firebase - 在 chrome 扩展程序中使用 Firebase Analytics

javascript - 在 Chrome 上右键单击获取超链接文本

google-chrome - chrome 扩展的键盘快捷键可以在 chrome ://extensions/shortcuts but not working 中看到

html - HTML5拖放期间没有关键事件

HTML/CSS - 删除顶部和侧边距

javascript - 三列,每列中的顶部 block 仅固定在列内滚动

javascript - 如何将拖动选定的单元格计数赋予 colspan 值

JavaScript/JQuery : How do I select the link inside a <td> element when it has a certain style

html - 当浏览器窗口缩小时,如何将 <div> 和表格保留在它们的位置?

javascript - 为什么文字处理不起作用?