... div> This div will be horizontally centered because it has margin: auto; </div> </body> </html> . Use of margin: auto. You can set the margin property to ...
You can set the margin property to auto to horizontally center the element within its container. The element will then take up the specified width, and the ...
2023年7月17日 — The margin property may be specified using one, two, three, or four values. Each value is a <length> , a <percentage> , or the keyword auto .