Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
React.js module.css select hidden element

I am using ant design and module css in a react project. For example, I have a code like below.

          <Tabs
            className={Style.PortfolioTabPanel}
            animated={{ inkBar: false, tabPane: true }}
            defaultActiveKey="1"
            centered={true}
            size={"large"}
            tabBarGutter={50}
            tabBarStyle={{
              color: "white",
            }}
          >
            <TabPane tab="Tab 1" key="1">
              Content of Tab Pane 1
            </TabPane>
            <TabPane tab="Tab 2" key="2">
              Content of Tab Pane 2
            </TabPane>
            <TabPane tab="Tab 3" key="3">
              Content of Tab Pane 3
            </TabPane>
          </Tabs>

The problem is exactly here, I can't see .ant-tabs-ink-bar element for example, ant design creates it automatically inside Tabs component.

When we wrote normal css, we could do this like this:

   <Tabs
    className="PortfolioTabPanel"
    animated={{ inkBar: false, tabPane: true }}
    defaultActiveKey="1"
    centered={true}
    size={"large"}
    tabBarGutter={50}
    tabBarStyle={{
      color: "white",
    }}
  >
    <TabPane tab="Tab 1" key="1">
      Content of Tab Pane 1
    </TabPane>
    <TabPane tab="Tab 2" key="2">
      Content of Tab Pane 2
    </TabPane>
    <TabPane tab="Tab 3" key="3">
      Content of Tab Pane 3
    </TabPane>
  </Tabs>

But now, when I type

.PortfolioTabPanel .ant-tabs-ink-bar { 
   background-color: red !important; 
}

in module.css file, the browser cannot see the selector because module.css has changed PortfolioTabPanel class name to PortfolioTabPanel_dynamical_id.

Has anyone encountered such a problem and found a solution?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to rewrite global styles using module.css file, you can do it as described in the documentation

:global(.PortfolioTabPanel) .ant-tabs-ink-bar { 
   background-color: red !important; 
}

related question Using css modules how do I define a global class

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda