In Bootstrap 4 and # 3 too, you can use offset
to set the div to the center of cointainer
.
Bootstrap 4
Notice that you just put offset-2
on the first div and it worked. (see that with this I have 2 + 4 + 4 + 2, you could do 3 + 3 + 3 + 3 putting col-3 offset-3
on the first div, just remember that max can add 12 ok) about the offset, will help you understand the concept. link
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<style>
div[class^="col-"] {
height: 50px;
box-sizing: border-box;
border: 1px solid;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-4 offset-2">Col 1</div>
<div class="col-4">Col 2</div>
</div>
</div>
Bootstrap 3
In this example I did with two columns of 3 and 3 of offset
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
/>
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<style>
div[class^="col-"] {
height: 50px;
box-sizing: border-box;
border: 1px solid;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-3 col-xs-offset-3">.col-md-3 .col-md-offset-3</div>
<div class="col-xs-3">.col-md-3</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>