Advertisement
NaroxEG

CSS Centering | Solution 2

Aug 28th, 2022
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.17 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.     transform: translate(-50%, -50%);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement