, it usually s...">

How does the JavaScript library set CSS styles by default (is there "! Notimportant"?)

When a JavaScript library is created <div>, it usually sets the class to a div so that the library user can style it themselves. However, usually for the JS library you need to set some default styles for <div>.

The most obvious way for a library to do this would be with inline styles:

<div style="application default styles" class="please-style-me">
  ...
</div>

However, this will cause application styles to outperform user styles by default. A workaround is to use nested divs:

<div style="application default styles">
  <div class="please-style-me">
    ...
  </div>
</div>

This works great for many styles, such as "font", but not for others, such as "position", where the inner style of the div will not override the outer divs.

JavaScript? , CSS ( ).

+5
2

JS , , , JS .

JavaScript CSS, .

, . - CSS.

, , . , CSS, - .

+2

CSS !notimportant !unimportant. . , CSS defacto , .

, , CSS - . , , !important .

!important CSS , , .

+1

All Articles