[英]Can anyone tell me why before not working on styled components?
I'm try to use before
on style components on React but it's not working.我
before
尝试在 React 上的样式组件上使用,但它不起作用。 Without before
background image shown but after adding this before
background image not showing;没有显示
before
的背景图像,但在没有显示背景图像before
添加了这个;
import styled from 'styled-components'
export const Container=styled.div `
&:before {
content:'';
top:0px;
left:0px;
right:0px;
position:absolute;
background-image:url(${({bg})=>bg});
background-size:cover;
}
`;
try::before with double ":" Also give some height/width try::before with double ":" 也给出一些高度/宽度
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.