Need to design 8 boxes in two rows - css

How to design 8 boxes like following using bootstrap?
Please ignore the colors each box would be similar to a visit card.
They should only be 8 boxes in two rows.
With specific margins to the right and left in big screens and no
margin in small screens. So in tablet should be 2 and in mobile
version only 1 per row. Also need to make sure the size of boxes are
all in the same size.
Demo
<div class="container-fluid">
<div style="border-style: solid;padding:1%;" class="col-md-2 col-md-offset-1">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
</div>

I know the question was about Bootstrap, but I thought it would be helpful for people to see it done with just html and css. I hate seeing people work real hard to make ugly solutions with Bootstrap, when this so basic if you didn't use Bootstrap.
CODEPEN
HTML:
just a list of business cards
<ul>
<li>
<img src="http://lorempixel.com/50/50/sports/" alt="John Doe"/>
<span class="content">
<strong>Johnny Realestate</strong>
johnny#realestate.io
222.333.4444
<address>
1 Real Estate Court<br>
suite 101<br>
Real, AZ 10101
</address>
</span>
</li>
... REPEAT
</ul>
CSS:
mobile first
display:flex;
0 to 599px => mobile layout |=| 1 item across
599px to 1024px => tablet layout |=|=| 2 items across
1024px and greater => desktop layout |=|=|=|=| 4 items across
ul {
list-style:none;
display:flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
max-width:1024px; // should match the page width, this value is also reflected in the media queries
width:100%;
margin: 0 auto; // auto can be replaced with any value
padding: 1em 0;
background: orange;
}
ul li {
width: 100%;
margin: 0 0 1em 0;
box-shadow:0px 0px 1px 1px black;
background: white;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
ul li img {
height:50px;
width: 50px;
margin: 0 5px 0 0;
}
ul li span {
width: calc(100% - 55px);
}
#media (min-width:599px){
ul li {
width: 49%;
margin: 0 2% 1em 0;
}
}
#media (min-width:599px) and (max-width:1024px){
ul li:nth-child(2n + 2){
margin: 0 0 1em 0;
}
}
#media (min-width:1024px){
ul li {
width: 24%;
margin: 0 1.3333333333% 1em 0;
}
ul li:nth-child(4n + 4){
margin: 0 0 1em 0;
}
}
There are lots of ways to optimize this example or tweak it to reach your goals. I hope this helps.
[UPDATE]
I added the prefixes for display:flex; and flex-wrap: wrap;, but if you can, you should add AutoPrefixer to your workflow!

My understanding from your question is that you want the container margin-left and right to be removed on smaller screens, so the cards touch the edge of the screen.
The demo below has the 8 cards in two rows. I have added some padding and margin to even up the spacing of the cards, the nth-child rule is used to apply that to the correct card.
If you want to keep the left and right margin, you can just exclude my media queries.
DEMO HERE
.card-row {
background: lightsalmon;
}
.card .inner {
height: 100px;
padding: 10px;
background: whitesmoke;
color: grey;
box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.2);
margin: 15px 0;
}
#media screen and (max-width: 991px) {
.container {
width: 100%;
}
.card:nth-child(odd) {
background: orange;
padding-left: 0;
}
.card:nth-child(even) {
background: darkorange;
padding-right: 0;
}
}
#media screen and (max-width: 767px) {
.card:nth-child(odd), .card:nth-child(even) {
background: coral;
padding: 0;
}
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="container">
<h3>Heading</h3>
<div class="row card-row">
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>Hello, I am beautiful content... please change me!</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
</div>
<div class="row card-row">
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>Hello, I am beautiful content... please change me!</p>
</div>
</div>
<div class="card col-xs-12 col-sm-6 col-md-3">
<div class="inner">
<p>hello</p>
</div>
</div>
</div>
</div>
I have also added some background-color - but you can remove that it's just to help you see the breakpoints and changes when you resize the browser.

you need to add col-lg-3 to your Div some like code Below.
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Thumbnail Gallery</h1>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<a href="#" class="thumbnail">
<img alt="" src="http://placehold.it/400x300" class="img-responsive">
</a>
</div>
</div>
</div>
OR See Link Below
http://ironsummitmedia.github.io/startbootstrap-thumbnail-gallery/

You can use a simple method is using the clear:both concept after every 4 elements in a row
<style>
.clear{clear: both;}
</style>
<div class="container-fluid">
<div style="border-style: solid;padding:1%;" class="col-md-2 col-md-offset-1">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div class="clear"></div>
<div style="border-style: solid;padding:1%;" class="col-md-2 col-md-offset-1">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div style="border-style: solid;padding:1%" class="col-md-2">
<div class="row">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
<div class="row">
<p>
Description
</p>
</div>
</div>
<div class="clear"></div>

Use the following markup
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
</div>
<div class="row" >
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%; ">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div style="border-style: solid; padding: 1%;">
<div class="row">
<div class="col-xs-6">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
<p>
Description
</p>
</div>
<div class="col-xs-6">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>
</div>
</div>
</div>
</div>

Try with this code: Demo
Update Link Demo with background color class
HTML:
<div class="container-fluid">
<div class="row pb10">
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-3 mt20">
<div class="card">
<div class="col-md-7">
<h4>Title</h4>
<p>Name</p>
<p>Family</p>
</div>
<div class="col-md-5 pt5">
<img class="img-responsive" src="http://placehold.it/150x150">
</div>
<div class="col-md-12">
<p class="desc">
Description
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
CSS:
.card {
border: 1px solid #333;
padding:1%;
}
.mt20 {
margin-top: 20px;
}
.pt5 {
padding-top:8px;
}
.pb10 {
padding-bottom:10px;
}
.desc {
border-top: 1px solid #999;
padding-top: 10px;
margin-top: 10px;
}

Assuming that you are using bootstrap:-
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
</div>
</div>
<!--second row-->
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
<div class="col-md-3">
hello
</div>
</div>
</div>

This one might help
Bootstrap Grid System
Html:
<div class="container-fluid">
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="www.example.com/photo">
</div>
</div>

This one might help
Bootstrap Grid System
Html:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container-fluid">
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<img class="img-responsive" src="http://www.hutchhouse.com/wp-content/uploads/2013/08/whats-changed-in-boostrap.jpg">
</div>
</div>

Use the following markup:
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="card">Text</div>
</div>
</div>
</div>
css:
.container-fluid{
overflow: hidden;
}
.row{margin: 0 -30px;}
.card{
border: 1px solid red;
margin: 15px 0;
padding: 15px;
background: #f0f0f0;
}
JSFiddle Demo

Related

Need help arrange items in a div with bootstrap

I'm trying to arrange a div like this but can't get it to work.
What I'm getting is this
My thought was to keep the image in its own column and then split the other columns into smaller rows and insert there but that doesn't seem to work. Here's my code:
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="row d-flex w-100 justify-content-between products-div">
<div class="col-sm-1">
<img [src]="prod.imagePath" class="product-page-images">
</div>
<div class="row">
<div class="col-sm-10">
<h3 class="mb-1">{{prod.name}}</h3>
<p class="products-price-text">${{prod.price}}</p>
</div>
</div>
<div class="row">
<div class="col-sm-10">
<h5 class="mb-1">{{prod.seller}}</h5>
</div>
</div>
<div class="row">
<div class="col-sm-10">
<p class="mb-1">{{prod.description}}</p>
</div>
</div>
</div>
</a>
HTML
<div class="container">
<div class="row">
<div class="main-container clearfix">
<div class="col-md-1">
<div class="img-con">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Small-city-symbol.svg/348px-Small-city-symbol.svg.png" alt="" />
</div>
</div>
<div class="col-md-11">
<div class="row">
<div class="col-md-12">
<div class="clearfix">
<div class="pull-left">
<h3>Name</h3>
<small>Seller</small>
</div>
<div class="pull-right">
<h3>Price</h3>
</div>
</div>
</div>
<div class="col-md-12">
<div class="desc">
description
</div>
</div>
</div>
</div>
</div>
</div></div>
css
.main-container
{
border:1px solid ;
}
.img-con
{
height:100%;
width:100%;
}
.img-con img
{
max-width:inherit;
max-height:inherit;
height:100%;
width:100%;
}
.desc
{
border:1px solid;
}
reference link
and style accordingly.. hope this helps

Using bootstrap - change a column to a row

I've got a layout which includes a row with 3 columns. Each column has 3 items listed vertically. I'm using Bootstrap.
<div class="row">
<div class="col-sm-4 ">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
<h3>SOMETHING</h3>
<div class="url"> https://something.com </div>
</div>
<div class="col-sm-4">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
<h3>NOTHING</h3>
<div class="url"> https://nothing.com/</div>
</div>
<div class="col-sm-4 appcontainer">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
<h3>EVERYTHING</h3>
<div class="url"> https://everything.com/</div>
</div>
</div>
When the row collapses at 767 px down to about 400 px the layout feels wrong as the individual columns don't fill the space very well. In that case I would like to have it displayed with the image on the left and the header and url on the right as though it were like this..
<div class="col-sm-4 ">
<div class="row">
<div class="col-xs-6">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
</div>
<div class="col-xs-6">
<h3>SOMETHING</h3>
<div class="url"> https://something.com </div>
</div>
</div>
</div>
Can this be accomplished with css and media queries? Or do I have to dig into some javascript?
It fells like I should be able set something up using display, but I haven't found a magic combination that does anything useful.
Please check the result:
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
#media (max-width: 400px) {
.col-xs-6 {
width: 100%;
}
}
.row {
margin-top: 15px;
}
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-4">
<div class="row">
<div class="col-xs-6 col-sm-12">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
</div>
<div class="col-xs-6 col-sm-12">
<h3>SOMETHING</h3>
<div class="url"> https://something.com </div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-4">
<div class="row">
<div class="col-xs-6 col-sm-12">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
</div>
<div class="col-xs-6 col-sm-12">
<h3>NOTHING</h3>
<div class="url"> https://nothing.com </div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-4">
<div class="row">
<div class="col-xs-6 col-sm-12">
<img class="img-responsive" src="http://placekitten.com/g/300/200">
</div>
<div class="col-xs-6 col-sm-12">
<h3>EVERYTHING</h3>
<div class="url"> https://everything.com </div>
</div>
</div>
</div>
</div>
</div>

I have a Single row within that I want to make 3 columns which are not related to each others height & width

In second column, I have a read more button, on click of that, text expands & the icons of 1st & 3rd column also comes down which I do not want... Somebody give me a demo template In which If I click the button, then only the icon below to the text div should come down and should not affect the position of other columns icons. I'm using this code...
<div class="grid">
<div class="row">
<div class="groups col-sm-4 col-xs-offset-4 career-description">
<h1>srv</h1>
<button class="btn-link favorite glyphicon glyphicon-bookmark CLbookmark"></button>
<h3 class="noData_Msg" style="text-align: center;">Sorry, Data is not available for this career.</h3>
<p class="brief_Desc_a">
</p>
<p class="det_DescF" ng-show="readMore">
</p>
<a class="link_b" ng-click="readMore = true" href="javascript:void(0)">Read More</a>
<a class="link_b" ng-click="readMore = false" href="javascript:void(0)">Read Less</a>
</div>
</div>
<div class="row career-cards">
<div class="groups col-sm-4">
<div class="future-trnds">
<img class="img-responsive" src="images/Future_trends_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4 col-xs-offset-8">
<div class="related-Careers">
<img class="img-responsive" src="images/Related_careers_v02.png" alt="">
</div>
</div>
</div>
<div class="row">
<div class="groups col-sm-4">
<div class="day-in-life">
<img id="no_Gray" class="img-responsive" src="images/Day_In_Life_v02.png" alt=""><img id="gray_Out" ng-Click="false" class="img-responsive gray_Icon hidden" src="images/Day_In_Life_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4">
<div class="introVideo">
<div class="vid_Dimension" style="height: 300px !important;" ng-hide="!video_Url" my-youtube code="video_Url">
</div>
<h3 class="no_Video" ng-show="!video_Url">Sorry, video is not available for this career.</h3>
</div>
</div>
<div class="groups col-sm-4">
<div class="cost-Salary">
<a href="javascript:void(0)" class="modal-cost modal-cont displayTooltip" title="Cost & Salary">
<img class="img-responsive " src="images/Cost_salary_v02.png" alt="Cost & Salary">
</a>
</div>
</div>
</div>
<div class="row">
<div class="groups col-sm-4">
<div class="honeycomb-wraper">
<div class="honeycomb" ng-include="'pages/traitTriangle.html'"></div>
</div>
</div>
<div class="groups col-sm-4">
<div class="courses_Colleges">
<img class="img-responsive " src="images/Courses_Colleges_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4">
<div class="honeycomb-wraper">
<!-- <div class="honeycomb" ng-include="'pages/iconicPeople_grid.html'"></div> -->
<div class="honeycomb" ng-include="'pages/workEnv_Hex.html'"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="content">
<div class="cont">
<div class="slide-text">
<span>Opportunity & Industries </span>
</div>
<div static-image ></div>
</div>
<div class="cont">
<div class="slide-text">
<span>Cost & salary</span>
</div>
<div class="slide-content">
<!-- <img class="img-responsive" alt="modal-image" title="modal-image" /> -->
<div ></div>
</div>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap.css">
</head>
<style>
.border{
border: 2px solid black;
}
.heightWidth{
height: 200px;
width: 200px;
}
</style>
<body>
<div class="col-lg-4 col-md-4 col-sm-12 border"> this is your first division
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
first image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
2nd image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
3rd image goes here
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 border"> this is your second divsion
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12">
your middle section the text part goess here
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 cl-sm-12 border"> this one is your third division
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
first image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
2nd image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
3rd image goes here
</div>
</div>
</div>
</body>
</html>
This will work.

Bootstrap Image Between Column

What would be the best / correct method to replicate the following using bootstrap. There are four colum, each of which is 25% wide, and I would like to add an image inbetween. The columns remain 25% all the way from mobile to desktop.
Simple
<div class="row">
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
</div>
</div>
</div>
PS: You may use text or content for + sign ... its upto you !! I prefer text/content because it will render faster then image.
This seems to do the job, though it's a bit convoluted. The 15-column layout is tricky.
.row.shift-left {
margin-left: -20px;
}
<div class="container-fluid">
<div class="row">
<div class="col-xs-11 col-xs-offset-1">
<div class="row shift-left">
<div class="col-xs-3">
<div class="row">
<div class="col-xs-9">Words words words.</div>
<div class="col-xs-3">
<img src="http://placehold.it/300x800" class="img-responsive" />
</div>
</div>
</div>
...
Demo

Boostrap's column's padding constrain in css

demo here http://www.bootply.com/stuqpDhmWp
As you can see in above demo, my img is 100% but the padding between the img is too big because left and right total is 30px. I wish it could be like the side which is 15px only. Any hack on that?
.container .col-md-3{ padding:0px 7.5px}
.container .col-md-3:first-child {padding-left:15px;}
.container .col-md-3:last-child {padding-right:15px;}
it will fix your problem
Try this:
To avoid padding use row in particular col
DEMO
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
<div class="col-lg-3 col-md-3 row">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
<div class="col-lg-3 col-md-3 ">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
<div class="col-lg-3 col-md-3 row">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-padding">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
<div class="col-lg-3 col-md-3 col-padding">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
<div class="col-lg-3 col-md-3 col-padding">
<img src="http://i.imgur.com/NRAVLP1.png">
</div >
<div class="col-lg-3 col-md-3 col-padding">
<img src="http://i.imgur.com/NRAVLP1.png">
</div>
</div>
</div>
css:
.col-padding{padding-right: 0}
.col-padding:last-child{padding-right: 15px}

Resources