Centering with Margin Auto in CSS


Center block elements horizontally with margin: auto.

Source Code

.center-block {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 50%; /* or any specific width */
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments