Twitter-bootstrap-3 | Thumbnail Centering? - center

Hey Guys!
I'm currently working on a website using twitter bootstrap 3 but I've got some issues. I'm trying to center the 3 thumbnails I've got. The text is centered, image is centered but I can't seem to get the thumbnails centered. Here is my code:
<div class="row">
<div class="col-sm-6 col-md-3">
<div class="thumbnail">
<img src="img/test.png">
<div class="caption">
<p>test</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="thumbnail">
<img src="img/test.png">
<div class="caption">
<p>test</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="thumbnail">
<img src="img/test.png>
<div class="caption">
<p>test</p>
</div>
</div>
</div>
CSS:
.thumbnail {
background-color: #cecece;
border: 1px solid #666;
text-align:center;
}

to center your content on the page, wrap the row in a containter ()
Notice that Bootstrap uses a 12 column grid. To fill your row with tree thumbs for the medium (md) grid, consider to use the col-md-4 class (3 x 4 = 12) class for your columns. ON the small (sm) grid you now have 3 columns of 50% by using three times the col-sm-6 class. Consider to use only one class, only the col-md-4 class will give you 3 columns for a screen width of 992px or wider and only the col-sm-4 class does the same but for screen widths of 768px and wider. Below the 992 or 768 the columns will stack.
The text can be centered by applying the text-center class, also see http://getbootstrap.com/css/#type-alignment
Also see: http://www.bootply.com/WAFUzlJs8s

Related

I am facing problem with the bootstrap 3 CSS class="thumbnail"

I wanted three images in each row...
<div class="row">
<div class="col-lg-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/1714208/pexels-photo-1714208.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500">
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/2103864/pexels-photo-2103864.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500">
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/1476321/pexels-photo-1476321.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500">
</div>
</div>
I expected it to be inside the border and all the images should have been of same size (three in each row) ...But its not.. help...
You have <div class="thumbnail">, but the built-in bootstrap 3 thumbnail classname is <div class="img-thumbnail">.
You say you want all images to be the same size, but your images have different proportions. Their pixel sizes are: 500x333, 500x750, and 500x375. What behavior do you want exactly? You could force them to all be the same height and width by setting adding styles for height=500px; width=500px;, but then the images will be distorted and squashed.
What you'll want to do is remove &w=500 from the image URLs so they scale to the dynamic width of the Bootstrap grid, and maybe also change the class on the columns to col-md-4 or col-sm-4 to make sure the images sit next to each other on smaller screens.
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/1714208/pexels-photo-1714208.jpeg?auto=compress&cs=tinysrgb&dpr=1">
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/2103864/pexels-photo-2103864.jpeg?auto=compress&cs=tinysrgb&dpr=1">
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="https://images.pexels.com/photos/1476321/pexels-photo-1476321.jpeg?auto=compress&cs=tinysrgb&dpr=1">
</div>
</div>
</div>
If you want all three images to have the same height as well, you could do something like this:
.thumbnail img {
max-height: 300px;
}
To achieve true dynamic uniformity, you should look at using Bootstrap 4 card groups instead.

How can I center the column vertically in bootstrap mobile mode?

I am trying to center the first column in the middle vertically , for the mobile mode xs:
<div class="row toplineheight vcenteritems totalblue visible-xs">
<div class="col-xs-6 vcenteritems small">Your order</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Upfront</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
This is my css(bootstrap 3):
.cart {
.verticalline {
border-left: thin solid #f7f7f7;
}
At the moment the 'your order' text stays stuck to the top of the div. How can I align this in the center?
Codepen here: codepen
using the class visible-xs on your .row element is overriding your display:flex css value. Moving the class to a containing element
CODEPEN
HTML
<div class="cart">
<div class="visible-xs"> <!-- move visible-xs class to a parent container -->
<div class="row toplineheight vcenteritems totalblue">
<div class="col-xs-6 vcenteritems small">Your order</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Upfront</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Monthly</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
</div>
</div>
</div>

Twitter Bootstrap 3: including img-responsive class seems to be resizing my container-fluid divs?

I hope someone can shed some light on this issue I'm having with Bootstrap.
I've noticed that my "container-fluid" divs that contain responsive images are slightly smaller than the "container-fluid" divs I have that just contain text.
I'm not sure why this, and it means the site I'm building has inconsistent sizing on the pages with responsive images. For example:
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 col-md-4"> <p> Test Paragrapgh </p> </div>
<div class="col-sm-6 col-md-4"> <p> Test Paragrapgh </p> </div>
<div class="col-sm-6 col-md-4"> <p> Test Paragrapgh </p> </div>
</div>
</div>
When I inspect the container-fluid element in chrome its size is 1600x50 px, yet when I replace the paragraphs with images:
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 col-md-4"> <img class="img-responsive" src="myimage.jpg" alt=""> </div>
<div class="col-sm-6 col-md-4"> <img class="img-responsive" src="myimage.jpg" alt=""> </div>
<div class="col-sm-6 col-md-4"> <img class="img-responsive" src="myimage.jpg" alt=""> </div>
</div>
</div>
The container-fluid element in chrome its size is now 1583x333 px, and every container-fluid on the page has shrunk to this smaller width. This means the navbar is a different size on this page compared to the others on my site - not good!
The css for img-responsive is fairly innocuous:
.img-responsive{
display: center-block;
max-width: 100%;
height: auto;}
So I'm stumped. I've looked at changing the margins on the img and img-responsive classes in the css but had no joy. Any suggestions will be greatly appreciated!
Thanks for the input. It turns out the problem was due to the images taking up more vertical space than the viewport could show, necessitating the addition of a scrollbar, which in chrome alters the width of the screen. This question has been asked already and answered elsewhere on stackoverflow.

Bootstrap CSS media Min device width?

I'm working on my own project.My menu have 6 buttons.
I did it with Bootstrap but when i open in Iphone web browser, the menu comes one row - one button.
I want to show two buttons for a row.
Maybe i can't explain my problem, so i added a screenshot.
here is the image;
1
Thanks for everything,
here is my code below;
<div class="box first">
<div class="row">
<div class="col-md-4 col-sm-6">
<div class="center">
<a href="orders.php"><img src="img/logo/siparis.png" width="78px" height="78px">
<h4 style="text-align:center">Sipariş takibi</h4></a>
</div>
</div>
<!--/.col-md-4-->
<div class="col-md-4 col-sm-6">
<a href="http://www.example.com/example-sifre-yenileme.html">
<div class="center">
<img src="img/logo/email_unut.png" width="78px" height="78px">
<h4 style="text-align:center">Şifre değiştirme</h4></a>
</div>
</div>
<!--/.col-md-4-->
<div class="col-md-4 col-sm-6">
<div class="center">
<a href="orderhasar.php"> <img src="img/logo/hasar.png" width="78px" height="78px">
<h4 style="text-align:center">Hasarlı sipariş destek talebi</h4></a>
</div>
</div>
<!--/.col-md-4-->
</div>
<!--/.row-->
</div>
You mean you want all the menu items to show side by side horizontally?
If so, you need to add a XS class declaration for mobile:
<div class="col-md-4 col-sm-6 col-xs-2">
With col-xs-2, it will fit 6 items in a row (12 total columns, 2 columns per menu item, 6 menu items).
You might have to play with the size of the items then!
EDIT:
To show a 2 button row, add col-xs-6 instead.
<div class="col-md-4 col-sm-6 col-xs-6">

Bootstrap grid div being pushed out at certain sizes

I wanted to create a layout with one image on the left taking up 6 columns and 2 'rows' and 4 squares on the right taking up the other half, i.e/ each one taking up 3 columns, 2 on top and 2 below.
This all works fine, except that 1 image gets pushed down. When the screen is made smaller, it pops back up, and then drops back down again at other smaller sizes.
Here it is on bootply
and here is my code:
<div class="container">
<div class="container-fluid">
<div class="row-fluid">
<div class="box1 col-md-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/Sheep-002-Wm.jpg">
</div>
<div class="box1 col-md-3 col-sm-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/roseveal.jpg">
</div>
<div class="box1 col-md-3 col-sm-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/roseveal5.jpg">
</div>
<div class="box1 col-md-3 col-sm-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/Sheep-002-Wm.jpg">
</div>
<div class="box1 col-md-3 col-sm-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/tentego_wagen.jpg">
</div>
</div>
</div>
</div>
My CSS is:
.box1 img {
width:100%;
}
.container {
width:100%;
padding:0px;
max-width: 1265px;
overflow: auto;
}
.row {
margin-left: 0px;
margin-right: 0px;
}
.col-md-3, .col-md-6, .col-sm-6 {
padding-left: 0px;
padding-right: 0px;
}
Please excuse the images - I'm meant to be designing a sort of farming website!
Any help or insight would be so much appreciated.
I have determined that it has to do with your images not being consistent.
Basically, your images are all different sizes, and you make no effort to enforce a standard upon them. You do put them in bootstrap columns, which is keeping them the proper widths, but the heights are still messing up and differing just slightly, which sometimes kicks your last image down to the next row.
I changed this css by adding a height:auto, which helped.
.box1 img{
width:100%;
height: auto;
}
I then tried making all four images on the right the same image, and the problem went away completely. I forked your bootply over here if you want to see the whole thing.
I have to say, It's looking pretty neat, you should be proud of yourself. It flows really well other than this hiccup. You might consider setting the max-height, or setting height to auto if you make sure that your pictures are all identical aspect ratios. They are already close to the same aspect ratio, but it's giving you these subtle difference that were difficult to detect visually, but are screwing up your layout.
Rufus, Try doing it like this.
Here is the full size Fiddle.
Using 3 sets of rows looks to help what you are looking to to here.
The extra classes also help keep the layout that you are looking for too.
<div class="container-fluid col-lg-12">
<div class="row-fluid col-sm-6 col-md-6 col-lg-6">
<div class="box1 col-sm-12 col-md-12 col-lg-12">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/Sheep-002-Wm.jpg">
</div>
</div>
<div class="row-fluid col-sm-6 col-md-6 col-lg-6">
<div class="box2 col-xs-6 col-sm-6 col-md-6 col-lg-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/roseveal.jpg">
</div>
<div class="box2 col-xs-6 col-sm-6 col-md-6 col-lg-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/roseveal5.jpg">
</div>
</div>
<div class="row-fluid col-sm-6 col-md-6 col-lg-6">
<div class="box2 col-xs-6 col-sm-6 col-md-6 col-lg-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/Sheep-002-Wm.jpg">
</div>
<div class="box2 col-xs-6 col-sm-6 col-md-6 col-lg-6">
<img src="http://www2.buit.ie/wp-content/uploads/2015/06/tentego_wagen.jpg">
</div>
</div>
</div>