A
A
Ambal892018-02-27 15:36:29
JavaScript
Ambal89, 2018-02-27 15:36:29

How to not apply a style file to a specific block using javascript?

Friends, tell me, I'm not strong in javascript, is it possible to make sure that a style file is not applied to a specific block on the site? For example, there is a style file app.css, there is a block, for example, with id="widget". How to write using javascript that the app.css file was not used for the widget block? If this is even real.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
TheRevan, 2018-02-27
@TheRevan

The only thing that comes to mind is to grind properties

E
Evgeny Kalibrov, 2018-02-27
@rework

Try connecting the external block with styles as a web component. You can read more about them here -
https://learn.javascript.ru/webcomponents In particular, pay attention to the Shadow DOM, which allows you to encapsulate the styles of an element so that it does not depend on global styles.

A
Alexey, 2018-02-27
@Azperin

Create a default.css file, just specify the class to which you want to reset all styles, include the same as app.css and apply the class to any block accordingly.
https://webref.ru/course/css-basics/priority

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question