CodePen

HTML

            
              <div>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent purus magna, bibendum quis nisi ut, consectetur condimentum dolor. Maecenas suscipit urna eget turpis rutrum, sed rutrum enim dictum. Integer id nulla lectus. Sed eu sollicitudin ante. Nunc vulputate pellentesque magna, sit amet facilisis dolor sollicitudin vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
</div>
            
          
!

CSS

            
              body {
  background: #900;
}

div {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  
  border: 1px solid black;
  
  /*
  This doesn't work
  margin-left: -25%;
  margin-top: -25%;
  */

  padding: 20px;  
  background: red;
  color: white;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
}
            
          
!

JavaScript

            
              
            
          
!
999px
Loading ..................