bootstrap grid: position not symmetric - html

So i'm building this portfolio type website and i just can't get the bootstrap grid to work properly. As you can see in the image, the second big row, which starts with the big image is not symmetric to the first row. I don't really understand where the problem is. I've managed to do that without bootstrap using fixed width and height, but that really is not an option as i would loose all the responsiveness. What am i doing wrong here?
<section class="container-fluid" style="max-width: 1980px; min-width:1280px;">
<div class="row">
<div class="col-md-7" style="padding-right: 0">
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
</div>
<div class="col-md-5" style="padding-left: 0">
<div class="col-md-12" style="padding: 5px;">
<img src="http://placehold.it/780x415" class="img-responsive">
</div>
</div>
</div>
<div class="row">
<div class="col-md-5" style="padding-right: 0">
<div class="col-md-12" style="padding: 5px;">
<img src="http://placehold.it/780x415" class="img-responsive">
</div>
</div>
<div class="col-md-7" style="padding-left: 0">
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
<div class="col-md-4" style="padding: 5px;">
<img src="http://placehold.it/350x200" class="img-responsive">
</div>
</div>
</div>
</section>
UPDATE:
So I actually managed to solve my problem, by creating two new column classes - col--small-blocks and col--large-blocks
.col-xs-small-blocks,
.col-sm-small-blocks,
.col-md-small-blocks,
.col-lg-small-blocks {
position: relative;
min-height: 1px;
padding: 0;
}
.col-xs-small-blocks {
width: 60%;
float: left;
}
#media (min-width: 768px) {
.col-sm-small-blocks {
width: 60%;
float: left;
}
}
#media (min-width: 992px) {
.col-md-small-blocks {
width: 60%;
float: left;
}
}
#media (min-width: 1200px) {
.col-lg-small-blocks {
width: 60%;
float: left;
}
}
.col-xs-large-blocks,
.col-sm-large-blocks,
.col-md-large-blocks,
.col-lg-large-blocks {
position: relative;
min-height: 1px;
padding: 0;
}
.col-xs-large-blocks {
width: 40%;
float: left;
}
#media (min-width: 768px) {
.col-sm-large-blocks {
width: 40%;
float: left;
}
}
#media (min-width: 992px) {
.col-md-large-blocks {
width: 40%;
float: left;
}
}
#media (min-width: 1200px) {
.col-lg-large-blocks {
width: 40%;
float: left;
}
}
This solved the problem, that bootstrap originally doesn't have classes for 5 column grid, so as you can see I created a column for my small images which takes up 60% of space and a column for my large blocks which takes up 40% of space. After that I just used col-md-4 to create the small blocks and col-md-12 for the large blocks
<section class="container-fluid" style="max-width: 1980px; min-width:1280px;">
<div class="row">
<div class="col-md-small-blocks">
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
</div>
<div class="col-md-large-blocks">
<div class="col-md-12 block-padding">
<img src="http://placehold.it/750x405" class="img-responsive">
</div>
</div>
</div>
<div class="row">
<div class="col-md-large-blocks">
<div class="col-md-12 block-padding">
<img src="http://placehold.it/750x405" class="img-responsive">
</div>
</div>
<div class="col-md-small-blocks">
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
<div class="col-md-4 block-padding">
<img src="http://placehold.it/375x200" class="img-responsive">
</div>
</div>
</div>
</section>
And now as you can see, everything is symmetric and responsive :)

Related

Bootstrap responsive panel with thumbnails and custom content, not exactly responding as expected

So I'm in a coding Boot camp, been coding for a little over 1.5 months. For one of my assignments, I was to create a mobile responsive portfolio using Bootstrap. The directions clearly stated not to use media queries, as the queries are under the hood on of my TAs told me. Inasmuch as I'm not allowed to implement explicit use of queries, I seem to be stumped. I already turned the assignment is, but dont want to skim ovedr the solution - if there is one. Here is my html:
<div class="container" id="page">
<div class="row">
<div class="col-md-8 col-xs-12">
<div class="container-fluid">
<div class="panel" id="main-section">
<div class="panel-heading">
<h4 id="headings">Portfolio</h4>
<div class="row" id="box-search">
<div class="col-md-6 col-xs-12">
<div class="thumbnail text-center">
<img src="hangman.jpg" class="image-responsive" id="images-left">
<div class="caption">
<p style="background-color: #2c3e50; color: #ffffff" id="text-box">Hangman</p>
</div>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="thumbnail text-center">
<img src="rpg.jpg" class="image-responsive" id="images-right">
<div class="caption">
<p style="background-color: #2c3e50; color: #ffffff">Role Player Game</p>
</div>
</div>
</div>
</div>
<div class="row" id="box-search">
<div class="col-md-6 col-xs-12">
<div class="thumbnail text-center">
<img src="trivia.jpg" class="image-responsive" id="images-left">
<div class="caption">
<p style="background-color: #2c3e50; color: #ffffff"`enter code here`>Trivia</p>
</div>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="thumbnail text-center">
<img src="rutgers.jpg" class="image-responsive" id="images-right">
<div class="caption">
<p style="background-color: #2c3e50; color: #ffffff" id="text-box">Rutgers Info Widget</p>
</div>
</div>
</div>
</div>
<div class="row" id="box-search">
<div class="col-md-6 col-xs-12">
<div class="thumbnail text-center">
<img src="rps.jpg " class="image-responsive " id="images-left">
<div class="caption">
<p style="background-color: #2c3e50; color: #ffffff;" id="text-box">Rock Paper Scissors</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
and the css:
.thumbnail {
position: relative;
}
.caption {
position: absolute;
top: 75%;
left: 0px;
width: 190px;
text-align: center;
}
#images-left,
#images-right {
height: 190px;
width: 190px;
}
/*portfolio styling*/
#main-section-port {
min-width: 300px;
max-width: 640px;
float: left;
background-color: #ffffff;
margin-bottom: 80px;
}
and here is a link to the actual website if you'd like to see: afflatus480.github.io
Again, I already submitted the work, so no need to rush. But any help will be appreciated nonetheless. Thank you for your time.

how to put pictures in a row bootstrap

I'm trying to get these 3 pictures in a row with no or little spaces in between, but this code is causing them to stack on top of each other. I also want them to be aligned to the center of the page.
<div class="container">
<div class="row col-xs-2">
<img style= "width: 25%; height: 25%" src="https://image.ibb.co/ckA7ka/mr_marbles.png" alt="Mister Marbles head tilt">
</div>
<div class="row col-xs-2">
<img style= "width: 25%; height: 25%" src="https://image.ibb.co/bTMKyv/kermit.png" alt="Kermit the Dog">
</div>
<div class="row col-xs-2">
<img style= "width: 25%; height: 25%" src="https://image.ibb.co/ki8tQa/peach.png" alt="Peach posing magestically">
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-xs-4 thumb">
<a class="thumbnail" href="#">
<img class="img-responsive" src="http://placehold.it/400x300" alt="">
</a>
</div>
<div class="col-lg-4 col-md-4 col-xs-4 thumb">
<a class="thumbnail" href="#">
<img class="img-responsive" src="http://placehold.it/400x300" alt="">
</a>
</div>
<div class="col-lg-4 col-md-4 col-xs-4 thumb">
<a class="thumbnail" href="#">
<img class="img-responsive" src="http://placehold.it/400x300" alt="">
</a>
</div>
your code should be like this..
dont put class row on every col..
<div class="container">
<div class="row">
<div class="col-xs-2">
<img style="width: 25%; height: 25%" src="https://image.ibb.co/ckA7ka/mr_marbles.png" alt="Mister Marbles head tilt">
</div>
<div class="col-xs-2">
<img style="width: 25%; height: 25%" src="https://image.ibb.co/bTMKyv/kermit.png" alt="Kermit the Dog">
</div>
<div class="col-xs-2">
<img style="width: 25%; height: 25%" src="https://image.ibb.co/ki8tQa/peach.png" alt="Peach posing magestically">
</div>
</div>
</div>
sample code
**YOu need to put everthing in row then add one div with a class .center make the div center finally offset the the first column**
==============================================================
<style>
/*CENTER COLUMN */
.align-center {
text-align: center;
}
/*CENTER DIV*/
.center {
margin: 0 auto;
width: 80%;
}
</style>
<div class="container">
<div class="row">
<div class="center">
<div class="col-xs-2 align-center col-xs-offset-3"> <img style="width: 25%; height: 25%" src="https://image.ibb.co/ckA7ka/mr_marbles.png" alt="Mister Marbles head tilt"> </div>
<div class="col-xs-2 align-center"> <img style="width: 25%; height: 25%" src="https://image.ibb.co/bTMKyv/kermit.png" alt="Kermit the Dog"> </div>
<div class="col-xs-2 align-center"> <img style="width: 25%; height: 25%" src="https://image.ibb.co/ki8tQa/peach.png" alt="Peach posing magestically"> </div>
</div>
</div>
</div>
<img style= "width: 25%; height: 25%" src="webfina/2.png" alt="Kermit the Dog">
<img style= "width: 25%; height: 25%" src="webfina/3.png" alt="Peach posing magestically">

bootstrap remove vertical space from rows of thumbnail's grid

I am trying to remove vertical space between the rows of a thumbnail's grid as I did for that horizontal but with no success.
.gutter-0.row {
margin-right: 0;
margin-left: 0;
/* not working */
margin-top: 0;
margin-bottom: 0;
}
.gutter-0 > [class^="col-"], .gutter-0 > [class^=" col-"] {
padding-right: 0;
padding-left: 0;
/* not working */
padding-top: 0;
padding-bottom: 0;
}
HTML
<div class="row gutter-0">
<div class="col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
</div>
<div class="row gutter-0">
<div class="col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/200x200" alt="">
</div>
</div>
</div>
Bootply
How could I do?
Thank you
There is a margin bottom on the "thumbnail" classes.
Just add this to your css to remove it :
.thumbnail {
margin-bottom: 0;
}
Bootply
.thumbnail has 20px bottom margin. Either reset it or use the below style.
.thumbnail{
display: table-cell;
}
http://www.bootply.com/hDnBumWAdZ

Make the image layout more organized using bootstrap and CSS

So I have basically used manual percentages to make these images lie next together. As you see they are not very neatly layout or organized. How can I make it look more dashing?
Here's the code:
<div class="jumbotron jumbotron-fluid" style=" margin-top: 90px; ">
<div class="container">
<div class="row">
<div class="col-lg-2">
<img src="./assets/img/glass.jpg" class="img-responsive " style="width:95%"/>
<img src="./assets/img/rift.jpg" class="img-responsive m-y-1" style="width:95%;"/>
</div>
<div class="col-lg-8">
<img src="./assets/img/mhacks.jpg" class="img-responsive" style="width:100%; "/>
</div>
<div class="col-lg-2">
<img src="./assets/img/mindwave.png" class="img-responsive" style="width:120%;"/>
<img src="./assets/img/VR.png" class="img-responsive m-y-1" style="width:120%;"/>
</div>
</div>
</div>
</div>
Here's how it looks like:
http://imgur.com/e2I3yLu
Also here's the link to the website:
monajalal.github.io
Any suggestion is really appreciated. I wonder if there's a more straightforward method to image layout or any automatic method?
Set each image as a background image in a div:
<div class="jumbotron jumbotron-fluid" style=" margin-top: 90px; ">
<div class="container">
<div class="row">
<div class="col-lg-2">
<div style="background: url('./assets/img/glass.jpg'); background-size: cover;" class="img-responsive"></div>
<div style="background: url('./assets/img/rift.jpg'); background-size: cover;" class="img-responsive"></div>
</div>
<div class="col-lg-8">
<div style="background: url('./assets/img/mhacks.jpg'); background-size: cover;" class="img-responsive-large"></div>
</div>
<div class="col-lg-2">
<div style="background: url('./assets/img/mindwave.png'); background-size: cover;" class="img-responsive"></div>
<div style="background: url('./assets/img/VR.png'); background-size: cover;" class="img-responsive"></div>
</div>
</div>
</div>
</div>
Then set this css:
.img-responsive {padding-top: 60%; margin-bottom: 10px;}
.img-responsive-large {height: 208px; margin-bottom: 10px;}
#media screen and (max-width: 940px) {
.img-responsive-large {height: auto; padding-top: 60%;}
}
Try this... What I did was work with the grid. Use the padding from columns and even it with margins between the images, also set the images to 100% width. Class img-responsive sets a max-width of 100%, at least this way the image will fill the column.
<div class="jumbotron jumbotron-fluid">
<div class="container">
<div class="row">
<div class="col-lg-8">
<img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" class="img-responsive"/>
</div>
<div class="col-lg-2">
<img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" class="img-responsive "/>
<img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" class="img-responsive m-y-1"/>
</div>
<div class="col-lg-2">
<img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" class="img-responsive"/>
<img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" class="img-responsive m-y-1"/>
</div>
</div>
</div>
</div>
Remove the inline styling - and instead target the images in the css and add this.
.jumbotron img { width: 100%; margin: 15px 0; }

How to make the grid system centered horizontally?

I want to get the grid system to center but it won't, i was thinking maybe it has something to do with my pictures' border?. here's the screen shotwhat it is right now
what i want it to be
HTML:
<div class=" container">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
</div>
CSS:
.optionBorder
{
border: 1px solid #f5f5f5;
height: 130px;
width: 130px;
line-height: 130px;
text-align: center;
}
Take another element before row with some width and make them center
for example.:
HTML
<div class="test">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
</div>
</div>
CSS
.test {
width: 450px;
margin: auto;
margin-bottom: 15px;
}
bootply
<style>
.paraentCont{
width:100%;
max-width:300px;
margin:auto;
}
</style>
<div class=" container">
<div class="paraentCont">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
Give to .row fixed width such as 700px, and margin-left/right auto
look at this example http://www.bootply.com/GFDHc6p5tg
Actually here is there right way to go while using Bootsrap
Use the predefine class text-center
Use q Bootstrap helper like .inline-block{display: inline-block}
.inline-block{display: inline-block}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class=" container">
<div class="row text-center">
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
</div>