如果我有一个classic.css我想覆盖的文件(在这种情况下,它来自用于Python的Sphinx文档:https://docs.python.org/2.7/_static/classic.css)并且基本上是"撤消"规则,有办法做到这一点?
在这种情况下,有以下规则:
div.sphinxsidebar h3 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud)
我想做的就像是
div.sphinxsidebar h3,
div.sphinxsidebar h4
{
font-family: [revert-to-auto];
color: [revert-to-auto];
}
Run Code Online (Sandbox Code Playgroud)
所以我可以指定字体系列和颜色,body并让它适用于所有地方,而不必使用!important.
只是为了澄清:我的custom.css开头@import(classic.css);是按照Sphinx文档开头的,而不是通常使用的两个<link rel="stylesheet" type="text/css">元素<head>.
div.sphinxsidebar h3,
div.sphinxsidebar h4
{
font-family: initial;
color: initial;
}
Run Code Online (Sandbox Code Playgroud)
或Cascade Level 4引入revert,它将级联回滚到用户级别
div.sphinxsidebar h3,
div.sphinxsidebar h4
{
font-family: revert;
color: revert;
}
Run Code Online (Sandbox Code Playgroud)