CSS - completely remove spacing between columns? - html

I have this HTML:
<div class="container">
<div class="box center-block">
<div class="row">
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4">
<div class="thumbnail">A</div>
</div>
</div>
</div>
</div>
And CSS:
.box {
width: 300px;
padding-top: 100px;
}
.row > div > div {
width: 100px;
height: 100px;
margin: 0px;
}
I'm also using bootsrap (version 3).
I was able to remove margin between rows, but can't remove margin between columns. Is there a way to force it somehow?
I need all "squares" next to each other without any margins (both between rows and columns).
You can see how it looks here: https://jsfiddle.net/a91zujkj/

If you really want to use col- class, make sure to set the .thumbnail elements width to 100% and use a no-padding class on the col- elements.
Here is an example:
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.box {
width: 300px;
padding-top: 100px;
}
.no-padding {
padding-left: 0;
padding-right: 0;
}
.thumbnail {
width: 100%;
height: 100px;
margin: 0;
}
<div class="container">
<div class="box center-block">
<div class="row">
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 no-padding">
<div class="thumbnail">A</div>
</div>
</div>
</div>
</div>
You actually do not need to use col- classes at all and floats are not needed either. Another way to do this is using display: inline-block.
Here is how that looks:
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.wrapper {
width: 300px;
padding-top: 100px;
margin: 0 auto;
font-size: 0;
}
.item {
border: 1px solid #eee;
width: 100px;
height: 100px;
display: inline-block;
font-size: initial;
}
<div class="wrapper">
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
</div>
And if you're really brave you could also use CSS Grid layout. ;)
CSS Grid Layout
CSS Grid layout excels at dividing a page into major regions, or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.
Here is how that goes:
.wrapper {
padding-top: 100px;
width: 300px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(3,100px);
grid-template-rows: repeat(3,100px);
}
.item {
border: 1px solid #ddd;
height: 100px;
width: 100px;
}
<div class="wrapper">
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
<div class="item">A</div>
</div>

It's because .col-*-4 is wider than 100px, which is the width you've defined for the .thumbnail elements.
You can just remove the .col-* classes and use .pull-left instead.
.box {
width: 300px;
padding-top: 100px;
}
.row > div > div {
width: 100px;
height: 100px;
margin: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="box center-block">
<div class="row">
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
<div class="pull-left">
<div class="thumbnail">A</div>
</div>
</div>
</div>
</div>

Remove padding-left and padding-right for .col classes and then change width: 100px; to width: 100%; for .row > div > div
.box {
width: 300px;
padding-top: 100px;
}
.padding-0{
padding-right:0 !important;
padding-left:0 !important;
}
.row > div > div {
width: 100%;
height: 100px;
margin: 0px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="box center-block">
<div class="row">
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
<div class="col-md-4 col-xs-4 padding-0">
<div class="thumbnail">A</div>
</div>
</div>
</div>
</div>

Row has it's own style and add margin to element, you can remove it by adding :
.box >.row{
margin:0;
}

Related

Bootstrap grid overflow with images

I´m trying to acchive this image gallery using bootstrap grid layout:
but I can´t overflow the last image on the second row into the first row...
Here is my html code:
.gal-container {
display: block;
width: 100%;
padding: 16px;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
.box {
padding: 32px;
}
.row img {
max-width: 100%;
max-height: 100%;
}
<section>
<div class="gal-container">
<div class="box">
<div class="row">
<div class="col-sm-6 nopadding"><img src="img/image1.jpg"></div>
<div class="col-sm-3 nopadding"><img src="img/image2.jpg"></div>
<div class="col-sm-3 nopadding"><img src="img/image3.jpg"></div>
</div>
<div class="row">
<div class="col-sm-3 nopadding"><img src="img/image4.jpg"></div>
<div class="col-sm-3 nopadding"><img src="img/image5.jpg"></div>
<div class="col-sm-6 nopadding"><img src="img/image6.jpg"></div>
</div>
</div>
</div>
</section>
The result of this code is this:
I would appreciate the help to put the Stranger Things image at the bottom of the two small pictures :)
There's absolutely no custom css needed for this and the job can be done with less code using native Bootstrap 4 classes alone:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<section class="container">
<div class="row no-gutters">
<div class="col-sm-6">
<div class="row no-gutters">
<div class="col-12"><img src="img/image1.jpg"></div>
<div class="col-sm-6"><img src="img/image2.jpg"></div>
<div class="col-sm-6"><img src="img/image3.jpg"></div>
</div>
</div>
<div class="col-sm-6">
<div class="row no-gutters">
<div class="col-sm-6"><img src="img/image4.jpg"></div>
<div class="col-sm-6"><img src="img/image5.jpg"></div>
<div class="col"><img src="img/image6.jpg"></div>
</div>
</div>
</div>
</section>
Your markup is not matching as per your desired layout.It should be something like this :
<div class="box">
<div class="row">
<div class="col-sm-6 nopadding">
<div class="col-sm-12 nopadding">
<img src="img/image1.jpg">
</div>
<div class="row">
<div class="col-sm-6 nopadding">
<img src="img/image2.jpg">
</div>
<div class="col-sm-6 nopadding">
<img src="img/image3.jpg">
</div>
</div>
</div>
<div class="col-sm-6 nopadding">
<div class="col-sm-12 nopadding">
<img src="img/image4.jpg">
</div>
<div class="row">
<div class="col-sm-6 nopadding">
<img src="img/image5.jpg">
</div>
<div class="col-sm-6 nopadding">
<img src="img/image6.jpg">
</div>
</div>
</div>
</div>
</div>
Also add overflow:hidden in nopadding.
Hope it helps !
If you just swap around positioning and the wrappers, you should be able to get your desired effect
Also, you will have to take into account the paddings and widths you need as they will affect the positioning of the elements.
Demo works in full screen due to size
.gal-container {
display: block;
width: 600px;
padding: 16px;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
.box {
padding: 30px;
}
.row img {
max-width: 100%;
max-height: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="gal-container">
<div class="row">
<div class="col-sm-6 nopadding">
<div class="col-sm-12 nopadding"> <img src="http://via.placeholder.com/300x150"> </div>
<div class="col-sm-6 nopadding"> <img src="http://via.placeholder.com/150x100"> </div>
<div class="col-sm-6 nopadding"> <img src="http://via.placeholder.com/150x100"> </div>
</div>
<div class="col-sm-6 nopadding">
<div class="col-sm-6 nopadding"> <img src="http://via.placeholder.com/150x100"> </div>
<div class="col-sm-6 nopadding"> <img src="http://via.placeholder.com/150x100"> </div>
<div class="col-sm-12 nopadding"> <img src="http://via.placeholder.com/300x150"></div>
</div>
</div>
</div>

Creating a black and white grid HTML/CSS

I am trying to create a 3 by 3 black and white grid. But instead only black square is showing. I have tried using Bootstrap.
My one square of the grid should cover 3 grids space as per bootstrap grid system and I am using padding-top:100% to maintain the aspect ratio for the squares in the 3 by 3 grid.
body {
margin: 0;
color: pink;
}
.square {
width: 100%;
padding-top: 100%;
background-color: black;
}
.square-w {
width: 100%;
padding-top: 100%;
background-color: white;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="square"></div>
</div>
<div class=" col-md-3 ">
<div class="square-w"></div>
</div>
<div class=" col-md-3 ">
<div class="square"></div>
</div>
</div>
<div class="row">
<div class=" col-md-3">
<div class="square-w"></div>
</div>
<div class="col-md-3 ">
<div class="square"></div>
</div>
<div class="col-md-3">
<div class="square-w"></div>
</div>
</div>
<div class="row">
<div class="col-md-3 ">
<div class="square"></div>
</div>
<div class="col-md-3 ">
<div class="square-w"></div>
</div>
<div class="col-md-3 ">
<div class="square"></div>
</div>
</div>
</div>
Your screen view might be too small.
Changing all the col-md-3 classes to col-sm-3 allows it to be shown on my view
JSFiddle: https://jsfiddle.net/2k5523ym/1/
You just need to put below code in css
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
and then assign nopadding class to every col-md-3 div
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class=" col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class=" col-md-3 nopadding">
<div class="square"></div>
</div>
</div>
<div class="row">
<div class=" col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square-w"></div>
</div>
</div>
<div class="row">
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
</div>
</div>
Hope this help you

Border in row and columns of bootstrap divs

I have created a jsFiddle. I want the border should be between both row lines but background color to like what its showing in js fiddle. How can I extend this column border line.
My Html
<div class="container top5">
<div class="row">
<div class="col-md-12 col-xs-12">
<div class="row">
<div class="col-md-3 col-xs-3 inner">
<div><b>Type</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>SMS</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>Email</b></div>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<div class=""><b>Business Unit</b></div>
</div>
</div>
</div>
<div class="col-md-12 col-xs-12">
<div class="row border-between">
<div class="col-md-3 col-xs-3 inner">
<span>Another tesing text</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span> test</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span>Random text</span>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<span>Random text</span>
</div>
</div>
</div>
</div>
</div>
And Css
.top5 {
margin-top: 50px;
}
.row {
border: 1px solid;
}
.row + .row {
border-top:0 ;
}
My Fiddle - https://jsfiddle.net/ff49tu79/13/
you may wanna use padding instead of margin in cells and use flex box to flex the div cells together
.top5 {
margin-top: 50px;
}
.row {
border: 1px solid;
}
.row + .row {
border-top: 0;
}
.flx {
display: flex;
}
.inner {
background: aliceblue;
border-right: 1px solid blue;
padding: 10px 15px;
}
.inner-end {
background: aliceblue;
padding: 10px 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container top5">
<div class="row">
<div class="col-md-12 col-xs-12">
<div class="row">
<div class="flx">
<div class="col-md-3 col-xs-3 inner">
<div><b>Type</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>SMS</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>Email</b></div>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<div class=""><b>Business Unit</b></div>
</div>
</div>
</div>
</div>
<div class="col-md-12 col-xs-12">
<div class="row border-between">
<div class="flx">
<div class="col-md-3 col-xs-3 inner">
<span>Another tesing text</span>
<div>1</div>
<div>2</div>
</div>
<div class="col-md-3 col-xs-3 inner">
<span> test</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span>Random text</span>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<span>Random text</span>
</div>
</div>
</div>
</div>
</div>
</div>
See JSFIDDLE

How to make every second post reversed from first with nth-child

I saw on http://www.webdesignerdepot.com/ that even posts have image to the right, and odd posts image to the left. This is without a doubt solved with css.
I tried to solve this with css, but without success.
This is the code i have:
<div class="row">
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6" image>
<div class="col-xs-12 col-md-6" text>
</div>
</div>
</div>
i Want to make something like webdesignerdepot.com
Like this image i made:
Thanks for any ideas!
As others have mentioned, you can utilize CSS' float attributes, along with nth-child(odd) and nth-child(even) selectors.
Check this jsfiddle where I've used the following CSS:
.post:nth-child(odd) .row div:nth-child(odd),
.post:nth-child(even) .row div:nth-child(even) {
float: left;
height: 260px;
overflow: hidden;
width: 50%;
}
.post:nth-child(odd) .row div:nth-child(even),
.post:nth-child(even) .row div:nth-child(odd) {
float: right;
height: 260px;
overflow: hidden;
width: 50%;
}
div {
box-shadow: inset 0px 0px 1px #000;
}
Without float but display, direction will do the job for you.
display:flex;
.row .row {
display:flex;
width:400px;
height:200px;
border:red solid;
}
.row div .row >div {
flex:1;
display:flex;
align-items:center;
justify-content:center;
height:100%;
background:turquoise;
border:solid red;
direction:ltr;
}
.row .row div:nth-child(even) {
background:tomato;
}
.row :nth-child(even) .row{
direction:rtl;
}
<div class="row">
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
Or display:table
.row .row {
display:table;
table-layout:fixed;
width:400px;
height:200px;
border:red solid;
}
.row div .row >div {
display:table-cell;
text-align:center;
vertical-align:middle;
background:turquoise;
border:solid red;
direction:ltr;
}
.row .row div:nth-child(even) {
background:tomato;
}
.row :nth-child(even) .row{
direction:rtl;
}
<div class="row">
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6"> image</div>
<div class="col-xs-12 col-md-6"> text</div>
</div>
</div>
</div>
or display:flex and order
.row .row {
display: flex;
width: 400px;
height: 200px;
border: red solid;
}
.row div .row >div {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
background: turquoise;
border: solid red;
}
.row .row div:nth-child(even) {
background: tomato;
}
.row :nth-child(even) .row div:nth-child(even) {
order: -1
}
<div class="row">
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6">image</div>
<div class="col-xs-12 col-md-6">text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6">image</div>
<div class="col-xs-12 col-md-6">text</div>
</div>
</div>
<div class="col=xs-12 post">
<div class="row">
<div class="col-xs-12 col-md-6">image</div>
<div class="col-xs-12 col-md-6">text</div>
</div>
</div>
</div>
I can see that you're using Bootstrap. Maybe it would be worth you using their built-in .col-md-push-* and .col-md-pull-* modifier classes to swap them around.
From the Bootstrap docs:
<div class="row">
<div class="col-md-9 col-md-push-3">.col-md-9 .col-md-push-3</div>
<div class="col-md-3 col-md-pull-9">.col-md-3 .col-md-pull-9</div>
</div>
What this will result in is the two columns being reversed in order (.col-md-9 will render as coming after .col-md-3).
I would go with #krypsin's answer as you seem to be using bootstrap. But if you weren't, you could use css to do something like:
.post:nth-of-type(even) .row .col-xs-12.col-md-6:first-of-type{
float: right;
}
.post:nth-of-type(even) .row .col-xs-12.col-md-6:last-of-type{
float: left;
}
The :nth-of-type(even) applies styles to the children of every second .post class. The :last-of-type selector picks the last instance of that element type, and the :first-of-type selector applies styles to the first instance.

I want the logo and heading in center for all screen size

HTML CODE:
<div class="container-fluid">
<header class="header-area row">
<div class="container-fluid">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
CSS CODE:
.header-area .logo-area img {
width: 90px;
height: auto;
margin: 52px 0 120px;
}
.img-responsive {
margin: 0 auto;
}
I tried in many ways but i failed.The solution should be done using bootstrap.Please help me.
here is a solution, just add css display:inline-block and put all your tag between this html thg <center > </center>
here is modified code
.inline{
display: inline-block;
margin-right: auto;
margin-left: auto;
}
.header-area .logo-area img {
width: 90px;
height: auto;
margin: 52px 0 120px;
}
.img-responsive {
margin: 0 auto;
}
<center>
<div class="container-fluid">
<header class="header-area row">
<div class="container-fluid inline">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid inline">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
</center>`
good luck..
try adding 1 more class text-center to conrainer-fluid and remove any margins you applied in your css
<div class="container-fluid text-center">
<header class="header-area row">
<div class="container-fluid">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid text-center">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
Add this style in you CSS file:
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
And also add apply this class on your image:
<img class="img-responsive" src="images/logo.png" class=".center-block" alt="V" />
Demo