Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to exclude a tag from css class

Tags:

css

People also ask

How do I ignore a specific class in CSS?

You can override its rules in a more specific selector or put its rules in a selector not matching certain tags anymore. But you cannot ignore it as long as its there. Therefore you've to remove the class1 from the class attribute of the tag. You can achieve this with jQuery though.

How do you separate tags in CSS?

To apply the same CSS styles to more than 1 HTML elements tags, you can separate various HTML element tags selectors by using the , (comma character) in CSS. This will set the text color of both paragraphs to red . Like this, you can apply one style to many HTML element tag selectors separated by the comma character.

How do you say not last child in CSS?

:not(:last-child) The :last-child selector selects the last child. Combining these two above selector to excludes the last children (inner-div) of every parent div from the selection.


CSS cascades, meaning you can overwrite the values of previously defined properties.

You would do:

.statisticsTable tr.even, .statisticsTable tr.odd {
    font-weight: normal;
    font-size: DEFAULT; /* what ever your default is */
    font-family: DEFAULT; /* what ever your default is */
    /* I would use the font shorthand property */
    color: DEFAULT;
    background: DEFAULT;
}

If you want to use CSS3, you can use :not to only apply the following styles to TR elements which don't have the even or odd class:

.statisticsTable tr:not(.even):not(.odd) {
    font: bold 9pt Arial,Helvetica,sans-serif,Verdana,Geneva;
    color: #fff;
    background:#990000;
}

EDIT: not(.even,.odd) is not valid syntax thus will not work (at least not in Chrome) correct syntax is :not(selector) , however you can do :not(selector1):not(selector2) these not()s are on the same level.


In a browser that supports CSS3 pseudo-selectors (this includes most browsers, notably inluding IE7 and IE88 and not IE6), a selector like .statisticsTable tr:not(.even):not(.odd) for that second rule grouping would do what you want.