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

401
Vistas
How to fully fill child div in div with borders in Chrome?

I have a problem. I need to fill image in div with borders, but in Chrome 96.0 i see some inside margins from top and left, and don't know how to delete them.

This is my code:

.wrapper {
  width: 36px;
  height: 36px;
  border: solid 2px red;
  padding: 0;
}

.img {
  width: 100%;
  height: 100%;
  background: green;
  margin: 0;
}
<div class="wrapper">
  <div class="img"></div>
</div>

What I see:

enter image description here

What my friend sees in Safari:

enter image description here

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

0

I think it is rounding related issue: https://johnresig.com/blog/sub-pixel-problems-in-css/
It becomes clear when you change zooms levels.

As workaround we can set inset shadow on wrapper:

.wrapper {
  width: 36px;
  height: 36px;
  border: solid 2px red;
  padding: 0;
}

.img {
  width: 100%;
  height: 100%;
  background: green;
  margin: 0;
}

.shadow{
  /* add inset shadow to cover white gaps*/
  box-shadow: 0px 0px 2px 1px red inset;
 }
Normal output:
<div class="wrapper">
  <div class="img"></div>
</div>
<br>
With inset shadow:
<div class="wrapper shadow">
  <div class="img"></div>
</div>

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