“Como centralizar um elemento de bloco em linha” Respostas de código

Centro de alinhamento em bloco embutido

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

.child {
  display: inline-block;
}
Selfish Swan

Como centralizar um elemento de bloco em linha

  display: inline-block;
  position: relative;
  /* Move the element to the right by 50% of the container's width */
  left: 50%; 
  /* Calculates 50% of the element's width, and moves it by that */ 
  /* amount across the X-axis to the left */
  transform: translateX(-50%);
Depressed Dove

Respostas semelhantes a “Como centralizar um elemento de bloco em linha”

Perguntas semelhantes a “Como centralizar um elemento de bloco em linha”

Procure respostas de código populares por idioma

Procurar outros idiomas de código