Specially, there is a new attribute that allows us to control the attributes of multiple elements, which is: scoped. The new scoped attribute that appears on the style tag can make the CSS style only take effect on local elements. Specifically, it takes effect on the sub-elements of the element that stores this style style. The only difference from the normal style is that a new scoped attribute is added. Attributes:
Styles with the scoped attribute will only be applied to the current element and its child elements. Inline styles still have higher priority than scoped styles, so it is best to avoid using inline styles. Here is a mix of several styles to compare their efficiency range:
Any legal CSS style tag, such as media queries, can be used in scoped styles, like this:
This new scoped attribute is a very useful feature, especially for those who create templates, or CMS users, or some developers who cannot operate the entire style file. But it should be noted that some old browsers do not support this attribute. In this case, you may need to use the jQuery plug-in (https://github.com/thingsinjars/jQuery-Scoped-CSS-plugin ) to remedy this problem.