【问题标题】:some css styles not working in component.html but working in index.html一些 CSS 样式在 component.html 中不起作用,但在 index.html 中起作用
【发布时间】:2019-11-25 07:59:05
【问题描述】:

点击UI Element后添加类(打开)ti li,并打开折叠 但在 xxx.component.html 中没有 woking

截图

[]

【问题讨论】:

    标签: javascript css angular typescript


    【解决方案1】:

    如果我必须猜测您的问题,很可能您的 css 已在 index 组件中声明。 Angular 的 css 被封装或作用域。

    https://angular.io/guide/component-styles

    将您的 css 移动到 styles.css 或使用阅读指南并使用 host-cotontext (https://angular.io/guide/component-styles#host-context) 或禁用封装 (https://angular.io/guide/component-styles#view-encapsulation)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-28
      • 2015-01-25
      • 2020-10-04
      • 1970-01-01
      • 1970-01-01
      • 2015-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多