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

318
Visualizações
Media queries based on Container not Viewport

I am working on an app that has an expandable side bar which, when expanded, shrinks the content container and vice versa when the side bar is closed. I am using media queries to establish my breakpoints, but since media queries are based off of the viewport and not containers, the queries fire too late when the side bar is expanded (The content container is significantly smaller than the viewport when the sidebar is expanded).

Apparently there is a proposed container media query for future spec, but as it does not exist currently, I wanted to ask if there was a way to get around this issue. I'm sure I could use JavaScript to discover the container width and activate css based on that, but I am hopping to avoid that solution as I would have to add that to many components and it seems heavy handed.

Is there a way to base media queries off of container width rather than viewport width?

about 4 years ago · Juan Pablo Isaza
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