Skip to content

Latest commit

 

History

History
10 lines (5 loc) · 615 Bytes

Readme.md

File metadata and controls

10 lines (5 loc) · 615 Bytes

Skriptx Youtube Tutorials Repository

Centering a child div to parent div

Table Cell Method: Use display: table on the parent and display: table-cell, vertical-align: middle, and text-align: center on the child to center it both vertically and horizontally.

Position Method: Set the parent to position: relative and the child to position: absolute, then use top: 50%, left: 50%, and transform: translate(-50%, -50%) on the child to center it.

Flexbox Method: Apply display: flex, justify-content: center, and align-items: center to the parent to center the child both vertically and horizontally.