【发布时间】:2021-01-30 20:49:51
【问题描述】:
我有一个样式化的组件模态,它有几个 div 作为子元素。我需要在第二级设置 div 的样式。
<StyledComponentModal>
<div>
<div> // <-- This one needs styling
// ...
</div>
</div>
</StyledComponentModal
如何选择div?
我尝试使用div div:
const Modal = styled(MyModal)`
background: transparent;
height: auto;
margin: ${rem(0)} auto;
margin-top: 25vh;
width: 90vw;
div div {
/* doesn't work :( */
}
`;
我还尝试了其他东西,例如 &div div 等,但无法正常工作。
如何选择和设置该 div 的样式?
【问题讨论】:
标签: css css-selectors styled-components