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

319
Vistas
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 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