How can you center an element horizontally in CSS?
Ask by Ashutosh Patel
Updated 16 Oct 2024
Horizontal an Element-
Use
margin: 0 auto;on a block-level element with a defined width, or usedisplay: flex; justify-content: center;in a flex container.