CSS! Important rule of use, specifics

I am writing a bunch of PHP classes that will be used to create the Wordpress plugin, but can also be used in any other environment. After testing my script, everything itself looks good, but when I created the WP plugin for it, there were CSS conflicts that I envisioned. At first I planned to use specifics to solve them, but this can not always be done. This is in the default WP theme:

#content tr td {
    border-top: 1px solid #E7E7E7;
    padding: 6px 24px;
}

If I try to specify td so that there is no indentation, this will not work unless I add the identifier to my table and not to the class. I saw popular plugins that implemented an important rule on each CSS property, rather than using an identifier for specificity. What's better? I know that an important rule should be used sparingly, but adding an identifier to my table seems to contradict semantics, as there will be several instances of this table with the same identifier:

The language document identifier attribute allows authors to assign an instance identifier for a single element to the document tree.

http://www.w3.org/TR/CSS2/selector.html#id-selectors

EDIT: div , #content #main td , #someid td. , , , , "".

+3
1

, #content , , #content - ( , , WordPress, ... ).

, id !important , !important , !important , multiple id JavaScript, , , id id, .

, unrecommanded-but-valid-valid , undefined.

+3

Source: https://habr.com/ru/post/1794889/


All Articles