Answers for "howto align container center css"

CSS
89

center a div in css

.container {
  display: flex;
  justify-content: center;
  align-items: center;
}
Posted by: Guest on September-09-2020
0

how to center a div

/* Method 1: */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Method 2: */
.container {
	display: grid;
	place-items: center
}

/* Method 3: */
.center-div {
	margin: auto;
}

/* Method 4: */
.center-div {
  position: absolute;
  left: 50%;
  top: 50%;
}
Posted by: Guest on October-06-2021

Code answers related to "howto align container center css"

Browse Popular Code Answers by Language