how to add background image in styled components

187

import styled from 'styled-components';
import img from './img/bg.gif';
    
const Content = styled.div`
  border: 1px solid #000;
  background-image: url(${img});
  width: 2000px;
  height: 2000px;
`;
const Content = styled.div`
    background-image: url(${props => props.img});
`;
<Content img={ImagePath} />

Comments

Submit
0 Comments