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

126
Vistas
How to determine with what values is a div overflowing in all the directions?

I would like to know if there is any way by which I can determine with what quantities a div is overflowing in any direction. Searches in the internet only took me to the point where I can figure out the total horizontal or vertical values with which a div is overflowing. But, I wanted to know the exact top, right, bottom, left values.

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

0

You can use getBoundingClientRect and compute value on DOMRect value.

This API has a good browser support.

Inside a Reactjs component you should use ref for access to div at phisycal DOM.

import React from 'react';

const Foobar = () => {

  const onRef = (element) => {

    const domRect = element.getBoundingClientRect();
    
    console.log(`
        quantity before overflow top: ${domRect.y}px
        quantity before overflow left: ${domRect.x}px
        quantity before overflow right: ${window.screen.width - domRect.right}px
        quantity before overflow bottom: ${window.screen.height - domRect.bottom}px
    `);
  };
  
  return (
    <div ref={onRef}>
      {# ... #}
    </div>
  );

}

export default Foobar;
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