I'm try to use before
on style components on React but it's not working. Without before
background image shown but after adding this before
background image not showing;
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.