G
G
Grep12020-10-31 17:39:14
React
Grep1, 2020-10-31 17:39:14

How to add image from css file?

I did the import of the css file but it gives an error.
/var/www/app-uno/src Here is App.js and App.css
Image /var/www/app-uno/src/img
I can't figure out what the problem is

Failed to compile
./src/App.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss! ./src/App.css)
Error: Can't resolve '/img/bg.png' in '/var/www/app-uno/src'
This error occurred during the build time and cannot be dismissed.

import React from 'react';
import HeaderApp from './components/HeaderApp';
import BodyApp from './components/BodyApp';
import './App.css';


function App(){
  return(
    <article className="cart">
      <HeaderApp />
      <BodyApp />
    </article>
  );
};

export default App;

html{
  height: 100%;
}

body{
  min-height: 100%;
  background-image: url('/img/bg.png');
  display: flex;
    align-items: center;
    justify-content: center;
    font-family: Sans-serif;
}

.cart{
  display: flex;
  background-color: #fff;
  border-radius: 25px;
  width: 400px;
  flex-wrap: wrap;
  min-height: 400px;
  box-shadow: 0 0 11px 3px rgba(0,0,0,1);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question