CSS Selector for not a child of element type?

:not does not support combinator selectors.

If we’re talking about its direct parent:

:not(a) > code

Otherwise there’s no way to do this in CSS. You’ll have to override it:

code {
    /* some styles */
}

a code {
    /* override previous styles */
}

Leave a Comment