Answers for "html centering things"

CSS
1

how to make things center using css

// add to the parent element
.parent{
  	height:100vh;
	display:flex;
  	justify-content: center;
  	align-items: center;
}
or you can use 
// add to the parent element
.parent{
  	height:100vh;
	display:gird;
  	place-item:center;
}
Posted by: Guest on May-18-2021
24

center with css

.parent {
  position: relative;
}
.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
Posted by: Guest on January-03-2020

Browse Popular Code Answers by Language