0

I used to use

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

but i saw ppl also use

    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;

I know both working in same way, but i'd like to know which one is more efficient or more appropriate way for web standard.

Gia
  • 1
  • Either is fine; it depends entirely on what you are trying to achieve, and the code you are working with. – Obsidian Age Mar 04 '22 at 00:58
  • In the second way the container could stretch from the top to the bottom if it doesn't have an absolute max-height or height property. – ask4you Mar 04 '22 at 01:04

0 Answers0