Please see the images below
I am using bootstrap thumbnails. When i reduce my screen size using chrome's inpscet element, i get thumbnails as in image1, on further reducing i see the "Go to Page" and "View Details" buttons disorient. When i further reduce the screen size, number of images in a row reduces and again the buttons are aligned properly as in image3.
Please help me to increase the minimum width for my thumbnails which will lead me from image1 to image3... that is prevent dis-orienting the button positions.
here is the code for page content
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Home</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<style>
.thumbnail{
// min-width: 240px;
}
</style>
<!-- /.row -->
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
Recently added
</div>
<div class="panel-body">
<div class="row">
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
<!-- </div>
<div class="row">-->
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
<div class=" col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url()."assets/images/placeholder.jpg" ?>" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Go to page View Details</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
Top courses
</div>
<div class="panel-body">
List top uploaded courses
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
Bootstrap detects the browser window size to do the adaptation. Because the inspector goes inside the browser window when docked it will break you css layout.
To solve this you can create a new css class with bigger min-width property.
.my-thumbnail { min-width: 300px !important;} and add this css class to your thumbnail html element. Add important to override existing min-width.
Remember you'll have to do different ones for each of the screen sizes. You'll probably have to play with the size of the cols where the thumbnails are inside too.
You reduce browser to some height and width through browser console. Bootstrap responsiveness works on media queries, wherein, they will be setting relative values to respective elements based on min-width and max-width for screen. So it's like if it is between a range of value, then the particular styles gets applied. To know exactly how good the responsiveness is you need to use mobile emulator present in chrome browser.
So for example, if you see below media query
#media (min-width: 767px){
//some styles for grid where width=600px
}
#media (min-width: 1200px){
//some styles for grid where width=900px
}
Then until 768px of screen width the width of grid will be 900px and once it drops down it will reduce to 600px.
Conclusion
Since the screen width will be fixed for different devices and won't be between any irregular values, you should test the responsiveness either with the real devices or with the browser emulator which is shown in above image
Related
I'm using Bootstrap thumbnails with SVG that I got from Wikipedia but for some reason the SVG are all different sizes so it causes the thumbnail panels to not align.
Using what method can I make the thumbnail images the same height so that the thumbnail panels align?
Code:
<div class="row">
<div class="col-md-3">
<div class="thumbnail">
<img src="Flag_of_England.svg" style="width: 100%;" alt="England Chat">
<div class="caption">
<h3>England Chat</h3>
<p>...</p>
<p>Chat</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="thumbnail">
<img src="Flag_of_Ireland.svg" style="width: 100%;" alt="Ireland Chat">
<div class="caption">
<h3>Ireland Chat</h3>
<p>...</p>
<p>Chat</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="thumbnail">
<img src="Flag_of_Scotland.svg" style="width: 100%;" alt="Scotland Chat">
<div class="caption">
<h3>Scotland Chat</h3>
<p>...</p>
<p>Chat</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="thumbnail">
<img src="Flag_of_Wales.svg" style="width: 100%;" alt="Wales Chat">
<div class="caption">
<h3>Wales Chat</h3>
<p>...</p>
<p>Chat</p>
</div>
</div>
</div>
</div>
Screenshot:
It looks more like you'd need to adjust the height of images to align them, but it would have to be a fixed number which probably isn't ideal. You could made 2 rows, one for images and one for text, and as long as each row contained 4 rows with class="col-md-3" the content would all align vertically, but not sure there's another way around it
I've got a basic header with a logo on the far left and text on the far right (right aligned). As the page gets smaller the text overlaps with the logo and doesn't look great.
Fiddle here:
<div class="container">
<div class="row">
<div class="col-xs-2">
<img src="https://unsplash.it/100/100/?random" class="img-circle" alt="placeholder">
</div>
<div class="col-xs-10 text-right text-uppercase">
<h1>Scooby Doo</h1>
<h3>Where are you</h3>
</div>
</div>
</div>
How can I have everything shift to the middle and have my columns be centered on small screens? (logo on top, text underneath) Poured over Bootstrap documentation and can't figure it out with the grid system. If Bootstrap doesn't allow for that kind of re-positioning, is there a way with custom css/media queries?
You could use a combination of col-sm and col-xs to make sure they do not overlap
Fiddle
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-2">
<img src="https://unsplash.it/100/100/?random" class="img-circle" alt="placeholder">
</div>
<div class="col-xs-12 col-sm-10 text-right text-uppercase">
<h1>Scooby Doo</h1>
<h3>Where are you</h3>
</div>
</div>
</div>
As for aligning the text, you could use these media queries : https://github.com/twbs/bootstrap/issues/11292
Alternatively, if you would duplicate the block, you can achieve what you want with hidden-xs and visible-xs, however duplication is not something I would suggest as it reduces maintainability, but I added it to make the answer complete, as it is an option.
See this Fiddle which gives you this code
<div class="container">
<!-- Hidden only on XS, not centered -->
<div class="row hidden-xs">
<div class="col-sm-2">
<img src="https://unsplash.it/100/100/?random" class="img-circle" alt="placeholder">
</div>
<div class="col-sm-10 text-right text-uppercase">
<h1>Scooby Doo</h1>
<h3>Where are you</h3>
</div>
</div>
<!-- Only visible on XS, centered-->
<div class="row visible-xs">
<div class="col-xs-12 text-center">
<img src="https://unsplash.it/100/100/?random" class="img-circle" alt="placeholder">
</div>
<div class="col-xs-12 text-center text-uppercase">
<h1>Scooby Doo</h1>
<h3>Where are you</h3>
</div>
</div>
</div>
I'm using bootstrap and I have a row with 1 column and another row with 2 columns.
All items have one picture in it, and should take up all the avaible space inside the column.
So far I can't get the first image on the first row to fill the div width,this image resizes correctly when I reduce the window, but when I enlarge it, the picture will
resize to its original maximum size when I want it to be always same as the div width
Here is the snippet : https://jsfiddle.net/gd0obgg9/
Here is the code :
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Portfolio Item
</h1>
</div>
</div>
<div class="row">
<div></div>
<div class="col-md-12">
<img class="img-responsive" src="http://placehold.it/550x200" alt="">
</div>
<div></div>
</div>
<div class="row">
<hr>
<div class="col-sm-6 col-xs-12">
<a href="#">
<img class="img-responsive portfolio-item" src="http://placehold.it/300x300" alt="">
</a>
</div>
<div class="col-sm-6 col-xs-12">
<a href="#">
<img class="img-responsive portfolio-item" src="http://placehold.it/300x300" alt="">
</a>
</div>
</div>
</div>
</body>
I want my 550x200 to fill enterely the width
Any advice ? thanks
If I understood you correctly, to give the image full width use:
.img-responsive {
width: 100%;
}
Note that this will, in some cases, distort the image to cover the full div
In my test:
Update your css to set the width of img elements inside your columns to 100%.
you should add width:100% to your img
here the new code
<body>
<!-- Page Content -->
<div class="container">
<!-- Portfolio Item Heading -->
<div class="row">
<div class="col-lg-12 col-xs-12 col-md-12">
<h1 class="page-header">Portfolio Item
<small>Item Subheading</small>
</h1>
</div>
</div>
<!-- /.row -->
<!-- Portfolio Item Row -->
<div class="row">
<div>
</div>
<div class="col-md-12">
<img class="img-responsive" style="width:100%" src="http://placehold.it/550x200" alt="">
</div>
<div>
</div>
</div>
<!-- /.row -->
<!-- Related Projects Row -->
<div class="row">
<hr>
<div class="col-sm-6 col-xs-12">
<a href="#">
<img class="img-responsive portfolio-item" src="http://placehold.it/300x300" alt="">
</a>
</div>
<div class="col-sm-6 col-xs-12">
<a href="#">
<img class="img-responsive portfolio-item" src="http://placehold.it/300x300" alt="">
</a>
</div>
</div>
</div>
</body>
I am nesting what I believe is an [img col-xs-6] plus [img col-xs-6] under a [jumbotron col-xs-12].
Why doesn't the second image go under the first when I resize the web page?
<body>
<div class="container">
<div class="row col-xs-12 jumbotron">
<div class="row">
<div class="col-xs-6">
<img class="img-responsive" src="http://cdn8.openculture.com/wp-content/uploads/2014/11/Tolkien-publisher-3.jpg">
</div>
<div class="col-xs-6">
<img class="img-responsive" src="http://static.giantbomb.com/uploads/original/0/2848/425335-tolkien_photo_c.jpg">
</div>
</div>
</div>
</div>
</body>
This is because you are using xs- classes which means 2 columns on XS size window (mobile devices). You can change col-xs-6 to for example col-md-6 and you will have two columns on MD screens and 1 column on SM (tablet) and XS (mobile) screens.
Also you shouldn't have row after row immediately.
<div class="jumbotron>
<div class="container">
<div class="row">
<div class="col-md-6">
<img class="img-responsive" src="http://cdn8.openculture.com/wp-content/uploads/2014/11/Tolkien-publisher-3.jpg">
</div>
<div class="col-md-6">
<img class="img-responsive" src="http://static.giantbomb.com/uploads/original/0/2848/425335-tolkien_photo_c.jpg">
</div>
</div>
</div>
</div>
Learn more (Bootstrap grid system)
Learn more (Jumbotron)
I have a set of images that i want to create a set of buttons with titles from. My attempt so far is below....
Issue: the images seem to be skewed to reduce their width but not their height or indeed not stretch to their max size possible.
How can i keep the aspect ratio and center the image for 3 images each in their own column and of different sizes.
<div class="row row-bottomspace">
<div class="col-md-8 col-md-offset-2">
<!--carouselstart-->
<div class="feature">
<div class="col-md-4 text-center">
<div class="row text-center">
<img src="img/home/contactus.png" alt="residential image not available" class="img-responsive">
<h3 class="sitetext">Contact us</h3>
</div>
</div>
<div class="col-md-4">
<div>
<img src="img/home/gallery.png" alt="residential image not available" class="img-responsive">
<h3 class="sitetext">Our Gallery</h3>
</div>
</div>
<div class="col-md-4">
<div>
<img src="img/home/facebook.png" alt="residential image not available" class="img-responsive">
<h3 class="sitetext">Visit our Facebook page</h3>
</div>
</div>
</div>
</div>
</div>
CSS
.row-topspace {
padding-top: 2%;
}
.row-bottomspace {
padding-bottom: 2%;
.sitetext {
color: white;
font-family: 'Cooper Black';
font-size: 17px;
}
got a adequate solution, not perfect but simple. I set the parent div of the image to class="thumbnail" which by result centers the image" without distorting it. If anybody has a css only method then il set their answer to correct....
<div class="row row-bottomspace">
<div class="col-md-8 col-md-offset-2">
<!--carouselstart-->
<div class="feature">
<div class="col-md-4 text-center sitetext">
<div class="thumbnail siteImageButton">
<img src="img/home/contactus.png" alt="residential image not available" class="img-responsive">
<h3>Contact us</h3>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail siteImageButton">
<img src="img/home/gallery.png" alt="residential image not available" class="img-responsive">
<h3>Our Gallery</h3>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail siteImageButton">
<img src="img/home/facebook.png" alt="residential image not available" class="img-responsive">
<h3>Visit our Facebook page</h3>
</div>
</div>
</div>
</div>
</div>