Currently what I'm trying to achieve is this, where the first and sixth card of the image gallery is horizontally elongated and cards 2 to 5 are horizontally elongated, but all these cards 1 to 6 should fit perfectly in 2 rows as shown in ref image.
I'm using col-md-6 for the first image and col-md-3 for image 2 and 3 but for some reason the layout is still not what I want. The second row images start from the end of my cards 2 and 3 and my images are really stretched.
CodeSandBox: https://codesandbox.io/s/immutable-rain-6yx99?file=/src/App.js
Code:
<div className="container">
<div className="row">
<div className="col-md-6 col-sm-6">
<img src="https://c2.staticflickr.com/9/8817/28973449265_07e3aa5d2e_b.jpg"/>
</div>
<div className="col-md-3 col-sm-6">
<img style={{minHeight:"280px"}} src="https://c2.staticflickr.com/9/8356/28897120681_3b2c0f43e0_b.jpg"/>
</div>
<div className="col-md-3 col-sm-6">
<img style={{minHeight:"280px"}} src="https://c4.staticflickr.com/9/8887/28897124891_98c4fdd82b_b.jpg"/>
</div>
<div className="col-md-3 col-sm-6">
<img style={{minHeight:"280px"}} src="https://i.pinimg.com/originals/cc/18/8c/cc188c604e58cffd36e1d183c7198d21.jpg"/>
</div>
<div className="col-md-3 col-sm-6">
<img style={{minHeight:"280px"}} src="https://images.unsplash.com/photo-1454372182658-c712e4c5a1db?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8MXx8fGVufDB8fHx8&w=1000&q=80"/>
</div>
<div className="col-md-6 col-sm-6">
<img src="https://wallpaperaccess.com/full/1376490.jpg"/>
</div>
</div>
</div>
Every row has only 12 Col then end of it row so ,
in your code above y should close row after every 12 col .
Related
On my website www.asistaliavalencia.com, on the main page, I have a button bar. I would like to be able to arrange them so that they are all in the same row.
What html code can I add?
<div class="boxes-home">
**<section class="container">
<div class="row no-margin-negative justify-content-center">
<div class="col-sm-6 col-md-3 text-center pt-20-mb">**
<a href="https://asistaliavalencia.com/cuidadora-ancianos-valencia-por-horas/">
<div class="box-home">
<img src="https://asistaliavalencia.com/wp-content/uploads/2020/09/icon-home-1.png">
<p>Cuidadora de mayores por horas</p>
</div>
</a>
</div>
<div class="col-sm-6 col-md-3 text-center">
<a href="https://asistaliavalencia.com/cuidadora-de-ancianos-interna-en-valencia/">
<div class="box-home">
<img src="https://asistaliavalencia.com/wp-content/uploads/2020/09/icon-home-2.png">
<p>Cuidadora de mayores interna</p>
</div>
</a>
</div>
<div class="col-sm-6 col-md-3 text-center">
<a href="https://asistaliavalencia.com/servicio-acompanamiento-en-hospitales-valencia/">
<div class="box-home">
<img src="https://asistaliavalencia.com/wp-content/uploads/2020/09/icon-home-3.png">
<p>Servicio de acompañamiento en hospitales</p>
</div>
</a>
</div>
<div class="col-sm-6 col-md-3 text-center">
<a href="https://asistaliavalencia.com/servicios-quiropracticos-ancianos-valencia/">
<div class="box-home">
<img src="https://asistaliavalencia.com/wp-content/uploads/2020/09/icon-home-4.png">
<p>Servicios quiroprácticos</p>
</div>
</a>
</div>
<div class="col-sm-6 col-md-3 text-center">
<a href="https://asistaliavalencia.com/adaptacion-reforma-vivienda/">
<div class="box-home">
<img src="https://asistaliavalencia.com/wp-content/uploads/2020/09/icon-home-4.png">
<p>Adaptación y reforma de la vivienda</p>
</div>
</a>
</div>
</div>
</section>
</div>
You can see here an image of my problem
bootstrap row can only consist of 12 "col"s, you have 5 elements with size 3, you need to change all col-3 to col-2 and they will fit the row
or you can delete all size used from bootstrap and set sizes via % values of width attribute
Reduce the gap by playing with first from...
<div class="col-sm-6 col-md-3 text-center">
to
<div class="col-sm-2 col-md-1 text-center">
Keep playing with the spacing. Possibly do for last two before adjusting all.
Also add a "width:225px" to
.boxes-home .box-home {
width:225px
}
in .css file.
Instead of the col-md-3 class for those divs, use col-md-2 for all of them, and add col-md-offset-1 only to the first of those five divs.
That way the boxes will be two columns wide each, with an offset of one column for the first div (and therefore one column space after the last one), which centers those 5 boxes: 1 + 2 + 2 + 2 + 2 + 1 = 12 columns alltogether
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.
I have a responsive bootstrap table (1 tr and 3 td) and when it comes to xs devices I want them to flow down.
<div class="container-fluid" id="maincontent">
<div class="table-responsive">
<table class="table"><tr><td>
<div class="thumbnail" id="tropthumb">
<img src="images/mainconimg/trophy.jpg" alt="trophies" id="mainconimg">
<div class="caption">
<h3 id="trop">Trophies</h3>
<p>View</p>
</div>
</div>
</td>
<td>
<div class="thumbnail" id = "medalthumb">
<img src="images/mainconimg/medals.jpg" alt="trophies" id="mainconimg2">
<div class="caption">
<h3 id="medal">Medals</h3>
<p>View</p>
</div>
</div>
</td>
<td>
<div class="thumbnail" id = "souvnthumb">
<img src="images/mainconimg/souvn.jpg" alt="trophies" id="mainconimg3">
<div class="caption">
<h3 id="souvn">Souvenirs</h3>
<p>View</p>
</div>
</div>
</td></tr></table>
</div>
</div>
**I have this table with single row and 3 td on it and each of td contains a thumbnail image. And when it comes to xs devices I want them to flow down like in the example picture please help me with this.
this is what i wanted to look like when it comes to xs devices
Are you using tables for a specific purpose? Because if not, you can use the grid on Bootstrap.
e.g.
<div class="row">
<div class="col-md-4 col-xs-12"> "your image here" </div>
<div class="col-md-4 col-xs-12"> "your image here" </div>
<div class="col-md-4 col-xs-12"> "your image here" </div>
</div>
But you can omit the code col-xs-12 because I think col-md-4 automatically flows them down if you resize your screen.
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">
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