Advertisement
NaroxEG

Centering | Solution 1

Aug 28th, 2022
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.18 KB | None | 0 0
  1. .parent {
  2.     position: relative;
  3. }
  4.  
  5. /* Child width is 400px & height is 200px */
  6. .child {
  7.     position: absolute;
  8.     left: 50%;
  9.     top: 50%;
  10.     margin-left: -200px;
  11.     margin-top: -100px;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement