@nmnjnklc
Posted
Hello @yathishg,
there is no need for margins to center a div or some other element. Just add these properties to its parent element and you are good. For your particular situation:
body {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
This will also fix width problem on that card. Note that without that height: 100vh property, card would be horizontally centered, but not vertically. Centering card like does not require additional margins, widths, heights etc. to element.
Hope this helps. Happy coding!
Marked as helpful
@yathishg
Posted
@nmnjnklc thnks👍
@nmnjnklc
Posted
@yathishg you're welcome!