Jason S Jason S - 6 months ago 38
CSS Question

Is there a way to override a CSS rule to essentially negate it?

If I have a

file that I want to override (in this case it's from the Sphinx documentation used for Python: https://docs.python.org/2.7/_static/classic.css ) and essentially "undo" a rule, is there a way to do that?

In this case there are these rules:

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;

What I want to do is something like

div.sphinxsidebar h3,
div.sphinxsidebar h4
font-family: [revert-to-auto];
color: [revert-to-auto];

so I can specify the font-family and color in
and have it apply everywhere without having to use

Just to clarify: I have my
which starts with
as per the Sphinx documentation, rather than the usual use of two
<link rel="stylesheet" type="text/css">
elements in the


The CSS keyword inherit is usable for any property, and its function is to set the property to the value of the parent element.

[Originally posted as this comment, but I was asked to post it as an answer]