Welton122 Welton122 - 1 year ago 112
CSS Question

CSS * overriding class style

I'm having some difficulty with applying CSS. I have a text color specified in a global external style sheet, which uses * to apply the color. I'm now trying to override this for one specific class. I've tried setting the text color for the class within the header of the document (which if I'm correct should override the external sheet?), however the color will not change.

Google chrome inspector shows me that * is still dominating the class specification. Any ideas?

My external style sheet looks like this:

* {
font-size: 14px;
color: #666;

and my header style looks like this:

.error-list {
color: red !important;

Its worth mentioning that I've tried it with and without the !important.

Answer Source

Try making your CSS rule more specific. For example if your .error-list is made of li tags. Change your CSS rule to .error-list li to make it more specific.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download