Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
CSS not being applied to component in React

I have a CSS file which I have imported in the index.js file and the App.js as well, but still the CSS is not being applied to to the component

App.js:

import "./App.css";
function App() {
  return (
    <div classname="wrapper">
      <h1>BookList App</h1>
      <p>Add or remove books</p>
      <div classname="main">
        <div classname="form-container"></div>
        <div classname="view-container"></div>
      </div>
    </div>
  );
}

export default App;

index.js:

import React from "react";
import ReactDOM from "react-dom";
import "./App.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import "bootstrap/dist/css/bootstrap.css";

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

/
reportWebVitals();

File structure:

src:
|App.css
|App.js
|index.js

I am not able to understand why the CSS is not being applied even though I have imported it

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to replace classname with className ( N capital in className). It should fix your issue.

Try the code given below:

import "./App.css";
function App() {
  return (
    <div className="wrapper">
      <h1>BookList App</h1>
      <p>Add or remove books</p>
      <div className="main">
        <div className="form-container"></div>
        <div className="view-container"></div>
      </div>
    </div>
  );
}

export default App;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda