“centro div horizontal y verticalmente” Código de respuesta

centro div horizontal y verticalmente

.parent {
  position: relative;
}
.child {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
Concerned Crossbill

CSS Center vertical y horizontalmente

body {
	display: flex;
	min-height: 100vh;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}
/* to make "align-items: center" work: use "min-height: 100vh;"
100vh = 100% Viewport Height */
Horrible Hamerkop

CSS Center horizontal y verticalmente

.parent {
  position: relative;
}
.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
You'veYeedYourLastHaw

Center alinearse Div vertical y horizontalmente CSS

.parent{
	display: flex;
    justify-content: center;
  	align-items: center;
}
/* Child elements will be perfectly centered automatically */
Glorious Gnat

centrar cualquier cosa horizontal y verticalmente en CSS

.center {
  display: flex;
  align-items: center;
  justify-content: center;       
}
Stephen Oj

cómo centrar un div vertical y horizontalmente

.container{	
	margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  	width: /* Define the width here; */
    height: /* Define the height here; */
}

/*You have to define the width and height! */
Cheerful Chimpanzee

Respuestas similares a “centro div horizontal y verticalmente”

Preguntas similares a “centro div horizontal y verticalmente”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código