In the next image you can see what I want to achieve:
Desktop
Mobile
How can I do this?
I've been trying something like this:
<div class="row">
<div class="col-md-10">
<div class="row">
<div class="col-md-10" style="overflow:auto;">
<h1>Profile</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id ligula tincidunt eros eleifend porttitor. Maecenas cursus volutpat erat.
</p>
</div>
<!--feeds-->
<div class="col-md-2">
<h3>-- Feeds --</h3>
</div>
</div>
</div>
<!--fixed menu-->
<div class="col-md-2" style="background-color:#2ecc71;padding:3px;">
<div class="text-center">
<img src="/img/1.png" class="img-circle" style="max-width:150px">
<h3>hi!</h3>
</div>
<div>
<!-- menu links -->
</div>
</div>
</div>
Thanks in advance.
I believe this is what you're trying to do. You could use the default Bootstrap navbar by changing it's position rules (position: fixed;) to suit your needs while inside of a media query so once you're below 768px your nav adjusts to the default toggle nav. See Navbar for reference.
Working Example: Open at full page and reduce the viewport.
html,
body {
height: 100%;
}
#media (max-width: 767px) {
body {
padding-top: 50px;
}
}
#media (min-width: 768px) {
.navbar.sidebar-nav {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: auto;
height: 100%;
width: 200px;
background: #222;
overflow-y: auto;
}
.navbar.sidebar-nav .navbar-header {
width: 100%;
}
.navbar.sidebar-nav .navbar-header .navbar-brand {
float: right;
}
.navbar.sidebar-nav .navbar-nav {
width: 100%;
height: 100%;
text-align: right;
}
.navbar.sidebar-nav .navbar-nav > li {
float: none;
display: block;
}
.main-content {
margin-right: 200px;
}
}
/*THUMBNAIL FOR DEMO ONLY*/
.thumbnail {
border: none;
border-radius: 0px;
background: rgba(255, 255, 255, 0.75);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);
padding: 25px;
max-width: 500px;
margin: 12.5px auto;
}
/*THUMBNAIL FOR DEMO ONLY*/
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-fixed-top sidebar-nav">
<div class="container-fluid">
<div class="navbar-header">
<button data-toggle="collapse" type="button" class="navbar-toggle collapsed" data-target="#bs-nav">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Navbar Brand</a>
</div>
<div class="navbar-collapse collapse" id="bs-nav">
<ul class="nav navbar-nav">
<li>Link One
</li>
<li>Link Two
</li>
<li>Link Three
</li>
<li>Link Four
</li>
<li>Link Five
</li>
</ul>
</div>
</div>
</nav>
<div class="main-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/000/000" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="thumbnail">
<img src="http://placehold.it/450x450/f00/f00" class="img-responsive" />
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
Related
i have problem in Bootstrap Thumbnails.
my thumbnails is like that:
img01. but want to be horizontal.
What am i doing ?
My Code:
HTML:
<div class="hrs" align="center">
<div class="row">
<div class="col-xs-6 col-lg-6 col-md-6 col-sm-6">
<div class="thumbnail">
<img src="img/AxMahsool.jpg" alt="AxMahsool01" class="img-responsive" />
<img src="img/AxMahsool.jpg" alt="AxMahsool02" class=" img-responsive" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-lg-6 col-md-6 col-sm-6">
<div class="thumbnail">
<img src="img/AxMahsool.jpg" alt="AxMahsool03" class=" img-responsive" />
<img src="img/AxMahsool.jpg" alt="AxMahsool04" class=" img-responsive" />
</div>
</div>
</div>
</div>
Css:
.hrs{
display: table;
margin: 0 auto;
padding: 20px;
color: white;
It's because you have them in separate <div class="row"> containers. What you should do is put all of your images in the same row container(so take out the second <div class="row">) -and/or- try adding this code to your CSS:
.thumbnail>img { display: inline-block; }
I'm creating a simple image gallery. Above the images I name the place where the pictures were taken, but the second and every another row has issues - div with the name is being pushed to the right instead of staying centered. Here is how it looks: http://prntscr.com/fg10u4
#import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css);
.locationName {
text-align: center;
padding: 0px 0px 20px 20px;
}
<div class="row" id="locations">
<div class="locationName">
City
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="1.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
</div>
Obviously the code is doubled inside the "row" div.
Bring this below code out of row and that should go the way you want.
<div class="locationName">
City
</div>
You are facing this problem because you can see in the image(link) you
provided that the middle image has moved slightly down and hence
it affects the title of the next row everytime.
i saw your issue. actually there is a conflict with the boxes height. to quickly fix this you can increase your thumbs height equal. or you can see the example code below.
<div class="row" id="locations">
<div class="col-lg-12 col-sm-12 locationName">City</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="2.jpg"> </div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="1.jpg"> </div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="2.jpg"> </div>
</div>
<div class="col-lg-12 col-sm-12 locationName"> City </div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="2.jpg"> </div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="1.jpg"> </div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail"> <img src="2.jpg"> </div>
</div>
</div>
Add a full 12 column grid to the locationName class so that it takes up the whole row and force a break between the other columns. As you currently have it, it is trying to be placed inline, which is after the longest image.
<div class="row" id="locations">
<div class="col-xs-12 locationName">
City
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="1.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
</div>
Looks like there is a conflict with the bootstrap you are using. Try moving the title (City) before the div with class row.
<div class="locationName">
City
</div>
<div class="row" id="locations">
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="1.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
</div>
try this:
<div class="container" id="locations">
<div class="row">
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="1.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
</div>
<div class="locationName">
City
</div>
<div class="row">
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="1.jpg">
</div>
</div>
<div class="col-lg-4 col-sm-6">
<div class="thumbnail">
<img src="2.jpg">
</div>
</div>
</div>
</div>
You can use center tag like this
<div class="row" id="locations">
<center>
....
</center>
</div>
I was wondering if there was a better way to load images to a HTML file other than the <img> tag. I ask this because I am building a website that has a photo gallery. This photo gallery has 48 pictures and it seems to take forever to load.
Here is my HTML code for this page:
<!--IMAGES-->
<div class="container">
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Africabound_1.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0226.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0232.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0299.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0330.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0364.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0374.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0392.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0425.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0480.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0543.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0548.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0566.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSC_0615.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0841.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0902.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0909.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0914.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0929.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0957.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN0970.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1024.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1034.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1065.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1095.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1099.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1128.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1130.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1134.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1179.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1221.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1283.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1312.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1313.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1342.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1404.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1417.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1528.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1541.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1623.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/DSCN1624.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/IMG_1836.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/IMG_1849.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Photo May 14, 01 17 06.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Photo May 14, 01 22 01.JPG">
</div>
</div>
</div>
<div class="row">
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Photo May 14, 02 05 57.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Photo May 14, 02 28 54.JPG">
</div>
</div>
<div class=" col-xs-4 col-md-4 ">
<div class="thumbnail">
<img src="AfricaPictures/Photo May 14, 03 54 52.JPG">
</div>
</div>
</div>
</div>
</body>
</html>
<head>
As you can see, this is a monstrous three-hundred and sixteen lines of code. There must be a better way and I hope you will share it with me. Thanks in advance.
The <img>-element is the one to go for.
Be aware (if not already) that photos on the web should'nt exceed something like 500kb in file size (as a rule of thumb at least). Meaning you need reduce photo-size and kick out pixels. Here is a sample website where you can do it:
http://jpeg-optimizer.com/
As per the definition of HTML, <img> tags are one way to load image. You can also use background images, figures and the sort but the end result will be the same and there must always be a container to contain the image.
There is a lot of code going on there but sadly, the end result is a bit unavoidable. If you use rendering tools, it gives you the illusion that you are not managing it but in the end, the printed result will likely be the same once the code is rendered.
For your solution, there's a away to save a few lines left and right:
You can only wrap all your bootstrap columns in one row, since they are using float rules, you will save up a bit.
Hope this helps!
--FIRST IMAGE IS DESIRE OUTPUT---
I got it to work on my screen but when I put it on bigger monitor doesn't seem to scale right. Any Recommendations ?
<div style="margin-left: 100px;margin-right: 100px;">
<div class="container-fluid">
<div class="row">
<div class="col-sm-3">
<img src="img/NUESTROS EVENTOS -1.png">
</div>
<div class="col-sm-3">
<img s src="img/NUESTROS EVENTOS -2.png">
</div>
<div class="col-sm-3">
<img src="img/NUESTROS EVENTOS -3.png">
</div>
<div class="col-sm-3">
<img src="img/NUESTROS EVENTOS -5.png">
</div>
</div>
</div>
This is what I get with this other code, centers but can't get rid the spaces.
---THIS IS WHAT I GET---
<div class="row" style="margin-bottom: 70px;">
<!-- column -->
<div class="col-xs-6 col-sm-5cols wow bounceInLeft ">
<div class="thumbnail ">
<img src="img/NUESTROS EVENTOS -1.png">
</div>
</div>
<!-- column -->
<div class="col-xs-6 col-sm-5cols wow bounceInLeft ">
<div class="thumbnail">
<img src="img/NUESTROS EVENTOS -2.png">
</div>
</div>
<!-- column -->
<div class="col-xs-6 col-sm-5cols wow swing ">
<div class="thumbnail">
<img src="img/NUESTROS EVENTOS -3.png">
</div>
</div>
<!-- column -->
<!-- column -->
<div class="col-xs-6 col-sm-5cols wow bounceInRight ">
<div class="thumbnail">
<img src="img/NUESTROS EVENTOS -5.png">
</div>
</div>
</div>
You can use inline-block elements, I have created inline-block class to wrap img and gave text-center class to row to align images in center.
.row-custom .inline-block{
display:inline-block;
}
.row-custom .inline-block img{
max-width:100px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row row-custom text-center">
<div class="inline-block">
<img src="https://placeholdit.imgix.net/~text?txtsize=28&txt=300%C3%97300&w=300&h=300">
</div>
<div class="inline-block">
<img s src="https://placeholdit.imgix.net/~text?txtsize=28&txt=300%C3%97300&w=300&h=300">
</div>
<div class="inline-block">
<img src="https://placeholdit.imgix.net/~text?txtsize=28&txt=300%C3%97300&w=300&h=300">
</div>
<div class="inline-block">
<img src="https://placeholdit.imgix.net/~text?txtsize=28&txt=300%C3%97300&w=300&h=300">
</div>
</div>
Don't need to change or add more into CSS, You can use the Bootstrap class:
<div class="row">
<div class="col-sm-3">
<img class="img-responsive center-block" src="img/NUESTROS EVENTOS -1.png">
</div>
<div class="col-sm-3">
<img class="img-responsive center-block" src="img/NUESTROS EVENTOS -2.png">
</div>
<div class="col-sm-3">
<img class="img-responsive center-block" src="img/NUESTROS EVENTOS -3.png">
</div>
<div class="col-sm-3">
<img class="img-responsive center-block" src="img/NUESTROS EVENTOS -5.png">
</div>
</div>
Do these 3 things to achieve the desire result-
1. Add .img-responsive class to your img tags as its a way to make images responsive in bootstrap framework. You can also check this link for reference .
2. Add width="100%" to images to take up full space available in the image.
3. Add nopadding class to columns so that it will remove the padding space.
Update your code as below:
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-xs-3 nopadding">
<img src="https://dummyimage.com/600x400/000/fff" width="100%" class="img-responsive">
</div>
<div class="col-xs-3 nopadding">
<img s src="https://dummyimage.com/600x400/000/fff" class="img-responsive" width="100%">
</div>
<div class="col-xs-3 nopadding">
<img src="https://dummyimage.com/600x400/000/fff" class="img-responsive" width="100%">
</div>
<div class="col-xs-3 nopadding">
<img src="https://dummyimage.com/600x400/000/fff" class="img-responsive" width="100%">
</div>
</div>
</div>
Having problem styling the border.
What i want to achieve
What i have now
HTML codes
<div class="container">
<div class="col-sm-12 row">
<div class="col-sm-2 thumbnail">
<img class="img-responsive" src="images/ac/row_ac001_m0.jpg">
<div class="caption">
<p align="center"><b>Model No.Row-AC-001</b></p>
</div>
</div>
<img class="col-sm-2 img-responsive" src="images/ac/row_ac002_m0.jpg">
<img class="col-sm-2 img-responsive" src="images/ac/row_ac003_m0.jpg">
<!---continues------>
</div>
</div>
My CSS
.thumbnail {
border:1px;
width:15%;
border-style:solid;
}
.thumbnail{
border: thin gray solid;
border-radius: 0px !important;
margin: 0 5px;
}
.image_size{
width: 150px;
height: 150px;
display: block;
}
p{
font-size:12px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6 ">
<div class="thumbnail">
<img src="http://isomerica.net/~mlah/art/photos/small.nature.puffball.jpg" class="img-responsive image_size">
<p class="text-center">Your Text</p>
</div>
</div>
</div>
</div>
PS: Change your image size as per your need.
Here is JSFiddle
Hope this helps.
Based on the photos you provided.
The wider the screen, the more items per line.
.myitem {
display: inline-block;
width: 200px;
max-height: 310px;
border: 1px solid #fff;
}
.mycoolcontainer,
.myitem {
margin: .4em;
}
img,
.mycoolcontainer,
.myitem {
max-width: 100%;
}
body {
background: #131418;
color: #999;
text-align: center;
}
<div class="mycoolcontainer">
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
<div class="myitem">
<img src="http://placehold.it/200x200">Title
</div>
</div>
I have changed your code and appended below. I hope this will help you to solve your problem.
The formation should be like this, the grid size based on your requirement. You can change the grid size.
HTML
<div class="row">
<div class="col-sm-2 col-md-2">
<div class="thumbnail">
<img src="https://cdn.pixabay.com/photo/2016/12/22/05/41/muang-sing-historical-park-1924558__340.jpg" alt="...">
<div class="caption">
<p class="text-center">Row-AC-001</p>
</div>
</div>
</div>
CSS
.thumbnail img {
max-width: 150px;
}
.thumbnail .caption {
padding-top: 9px;
}
Codepen link attached,
http://codepen.io/WebTechie/pen/vyMqdY
use html this way:
<div class="container">
<div class="row">
<div class="col-sm-2">
<div class="thumbnail">
<img class="img-responsive" src="images/ac/row_ac002_m0.jpg">
<div class="caption">
<p align="center"><b>Model No.Row-AC-001</b></p>
</div>
</div>
</div><!-- First col -->
<div class="col-sm-2">
<div class="thumbnail">
<img class="img-responsive" src="images/ac/row_ac002_m0.jpg">
<div class="caption">
<p align="center"><b>Model No.Row-AC-001</b></p>
</div>
</div>
</div><!-- Second col -->
</div>
</div>
Use CSS:
.thumbnail {
border:1px solid #ccc;
}