If you are using the Bootstrap 4 version, you can horizontally center a grid column by applying the class .mx-auto on it. Let's try out the following example to see how it works:
Alternatively, you can also apply the class .justify-content-center on the .row element to center the column horizontally. Let's check out the following example:
But, in Bootstrap 3 things are little different. If the grid column number is even (e.g., 2, 4, 6, 8, 10, 12) you can use the class .col-{xs|sm|md|lg}-offset-* to align the column in center, like this:
However, if the grid column number is odd (e.g., 1, 3, 5, 7, 9, 11) you have to use some custom CSS. Let's check out the following example to understand how it basically works:
Use the
mx-auto
ClassIf you are using the Bootstrap 4 version, you can horizontally center a grid column by applying the class
.mx-auto
on it. Let's try out the following example to see how it works:Alternatively, you can also apply the class .justify-content-center on the .row element to center the column horizontally. Let's check out the following example:
But, in Bootstrap 3 things are little different. If the grid column number is even (e.g., 2, 4, 6, 8, 10, 12) you can use the class .col-{xs|sm|md|lg}-offset-* to align the column in center, like this:
However, if the grid column number is odd (e.g., 1, 3, 5, 7, 9, 11) you have to use some custom CSS. Let's check out the following example to understand how it basically works:
need an explanation for this answer? contact us directly to get an explanation for this answer