0

 .container{
   position: absolute;
   margin: 0 auto;// this doesn't position it in the centre anymore.
 }
<div class="container">
   this is a container
</div>

"This is supposed to be placed in the center... but when i positioned it as absolute, it went back to the top of the webpage. Is there anyway to bypass this."

Citizen Patrol
  • 260
  • 3
  • 13

1 Answers1

0

This will do it:

 .container{
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%,-50%);
 }
Kostas Minaidis
  • 4,681
  • 3
  • 17
  • 25