在angular2中自定义样式不起作用?
发布时间:2020-12-17 07:25:09 所属栏目:安全 来源:网络整理
导读:我正在尝试设计 ng-content使用内联css但似乎样式不适用于ng-content,我还需要做一些其他的样式设计? ng-content class="red"/ng-content p class="red"hello/p 这里的班级红色在p上工作但不在 Working Example ::内容被忽略. 这个结束了 您可以使用:: cont
我正在尝试设计< ng-content>使用内联css但似乎样式不适用于ng-content,我还需要做一些其他的样式设计?
<ng-content class="red"></ng-content> <p class="red">hello</p> 这里的班级红色在p上工作但不在 Working Example
::内容被忽略.
这个结束了 您可以使用:: content选择器 styles: ['.red {color:red} :host >>> upper {color:green}'] 要么 styles: ['.red {color:red} :host >>> * {color:green}']
另见讨论https://github.com/angular/angular/issues/7400#issuecomment-246922468 您可以使用:: content选择器 styles: ['.red {color:red} ::content >>> upper {color:green}'] 要么 styles: ['.red {color:red} ::content >>> * {color:green}'] 根据网络组件spec :: content应该足够了>>>不应该被要求,但没有它就没有应用风格. Plunker example (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |