【发布时间】:2016-12-12 09:16:58
【问题描述】:
我正在尝试将样式应用于子组件标签,但我不能这样做。
我有带有锚标记的子组件。
尽管我在父组件中有锚标记的样式,但它不适用。有什么解决办法?
工作代码:http://plnkr.co/edit/CJCpV4ZbG7hdxT2AeSmt?p=preview
<a href="https://www.google.com">Google</a>
在父组件中,我使用子组件并为此子组件应用样式。
HTML代码:
<div class="container">
<div class="test">
<testapp></testapp>
</div>
</div>
CSS代码:
.container{
font-family:sans-serif;
font-size:18px;
border: 1px solid black;
}
.test{
width:50%;
background-color:#f0f5f5;
}
.container:hover .test{
background-color:#e6ffe6;
}
.container:hover .test:hover{
background-color:#ffffe6;
}
.container .test a {
color: red ;
}
.container .test a:hover {
color:green;
}
【问题讨论】: