Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Intento anular las clases incorporadas de materialUI usando el archivo CSS, los estilos están aplicando todos los componentes en React, ¿cómo dejar de anular los estilos globalmente?

TableOne.css

 @media (min-width:601px) and (max-width: 960px) { .MuiTable-root .MuiTableBody-root{ display: flex !important; justify-content: center !important ; flex-wrap: wrap !important; row-gap: 15px; } }
 **above styles are applying to all the tables present in all my React components. But I want to apply for table that present in specific component. How I can write specific .css file for specific component**
  • Estoy tratando de acceder a las clases de materialUI incorporadas y aplicar estilos, por lo que los estilos afectan globalmente cómo puedo dejar de afectar los estilos en todos los componentes en React JS *
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  1. Cuando escribe CSS global de esa manera, se aplica a todo el documento. En su lugar, puede aprovechar la tematización en @mui/material .
  2. Use createTheme de @mui/material/styles para definir el tema y ThemeProvider para aplicar ese tema. Y en lugar de usar consultas de medios simples, use puntos de interrupción de tema , pero tendrá que especificar los valores de píxel para estos puntos de interrupción usted mismo si no está usando los predeterminados. También se puede hacer usando temas.
 import { createTheme } from "@mui/material/styles"; let theme = createTheme(); theme = createTheme(theme, { components: { MuiTableBody: { styleOverrides: { root: { "@media (min-width: 601px) and (max-width: 960px)": { // your styles here }, [theme.breakpoints.between("md", "lg")]: { // use this instead } } } } } }); export default theme;
  1. En su componente, envuelva su componente Table con ThemeProvider
 import Table from "./components/Table"; import { ThemeProvider } from "@mui/material/styles"; import theme from "./theme/MuiTable"; // this is the theme you created above ... const App = props => { return ( <div className="App"> <ThemeProvider theme={theme}> <Table /> </ThemeProvider> </div> ); }

Aquí hay una demostración de trabajo

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!