Create small image gallery with same size image - html

I am creating a gallery with a number of images but the images are viewed in different size and they don't look attractive. I tried to change the height to 100px but all the images are overlapped. I want different sized images to be viewed as same size and also maintain its responsiveness.How can I make them responsive and of same size?
/*
var importantStuff = window.open('', '_blank');
importantStuff.document.write('Loading preview...');
importantStuff.location.href = 'index.html';
*/
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
padding: 20px;
font-family: Arial;
}
.main {
max-width: 1000px;
margin: auto;
}
div.gallery {
border: 1px solid #ccc;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
background-color: white;
}
* {
box-sizing: border-box;
}
.responsive {
float: left;
width: 50%;
padding: 5px;
}
#media screen and (max-width: 600px) {
.responsive {
width: 100%;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
<div class="main">
<h1>Image Compression</h1>
<hr>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="1.png">
<img src="1.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:1</h3>
</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="2.png">
<img src="2.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:2</h3>
</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="3.png">
<img src="3.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:3</h3>
</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="4.png">
<img src="4.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:4</h3>
</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="5.png">
<img src="5.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:5</h3>
</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="6.png">
<img src="6.png" width="600" height="400">
</a>
<div class="desc">
<h3>Image:6</h3>
</div>
</div>
</div>
</div>

One suggestion would be to limit the img size with the a-tag around it. Check my changes for the a- and img-tag in my example:
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
padding: 20px;
font-family: Arial;
}
.main {
max-width: 1000px;
margin: auto;
}
div.gallery {
border: 1px solid #ccc;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery a {
display: block;
width: 100%;
overflow: hidden;
height: 100px;
}
div.gallery img {
min-width: 100%;
}
div.desc {
padding: 15px;
text-align: center;
background-color: white;
}
* {
box-sizing: border-box;
}
.responsive {
float: left;
width: 50%;
padding: 5px;
}
#media screen and (max-width: 600px) {
.responsive {
width: 100%;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
<div class="main">
<h1>Image Compression</h1>
<hr>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="1.png">
<img src="https://placehold.it/200x150">
</a>
<div class="desc"><h3>Image:1</h3></div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="2.png">
<img src="https://placehold.it/200x100">
</a>
<div class="desc"><h3>Image:2</h3></div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="3.png">
<img src="https://placehold.it/150x200">
</a>
<div class="desc"><h3>Image:3</h3></div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="4.png">
<img src="https://placehold.it/200x300">
</a>
<div class="desc"><h3>Image:4</h3></div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="5.png">
<img src="https://placehold.it/150x150">
</a>
<div class="desc"><h3>Image:5</h3></div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="6.png">
<img src="https://placehold.it/200x200">
</a>
<div class="desc"><h3>Image:6</h3></div>
</div>
</div>
</div>
Problem with this solution is, that images are cut of, if the dimensions don't fit.

Related

Responsive CSS/HTML for Tablet or Mobile Device

I have created a landing page for a SharePoint site with graphics. I have noticed that when resizing the browser window to that of something like a tablet or mobile device, the page/graphics aren't responsive and adjusting to the sizing.
I came across a few posts in relation to my issue, but none were very helpful.
Here is my HTML/CSS:
html, body {
margin: 0;
height: 100%;
}
.img_container {
border: none;
width: 70%;
padding: 10px;
height: auto;
display: block;
justify-content: center;
align-items: center;
}
a {
text-decoration: none;
}
a:link, a:visited {
color: #b3ab7d;
}
a:hover {
color: #b3ab7d;
}
.background {
background: #104723;
width: 150px;
height: 150px;
}
.img {
width: 70%;
display: block;
margin: 0 auto;
}
a {
display: block;
text-align: center;
}
.text{
font-size: 70%;
}
*{
box-sizing: border-box;
}
.center {
display: flex;
justify-content: center;
align-items: center;
}
h1{
text-align: center;
color: #104723;
top: -10px;
}
<head>
<h1><strong>G3G Controls</strong></h1>
</head>
<div class="center">
<div class="img_container">
<a href="/ACControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Access Control (AC)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/IAControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Identification & Authentication (IA)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/MPControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Media Protection (MP)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/PEControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Physical Protection (PE)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/SCControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">System & Communications Protection (SC)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/SIControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">System & Information Integrity (SI)</span>
</div>
</a>
</div>
</div>
You have used flexboxes that was enough to make stuff responsive the property you were lacking was setting a flex-wrap:wrap for the .center class which will let the images wrap to the next line as soon as the width of the container element reduces.
AlsoThe .img_container for the images was creating an issue due to its width:70% and it also needs to be set to display:flex which will allow these images to accommodate side by side as you want. I also changed The container element .center width to 100%.
The Proposed Code
html, body {
margin: 0;
height: 100%;
}
.img_container {
display:flex;
border: none;
padding: 10px;
height: auto;
display: block;
justify-content: center;
align-items: center;
}
a {
text-decoration: none;
}
a:link, a:visited {
color: #b3ab7d;
}
a:hover {
color: #b3ab7d;
}
.background {
background: #104723;
width: 150px;
height: 150px;
}
.img {
width: 100%;
display: block;
margin: 0 auto;
}
a {
display: block;
text-align: center;
}
.text{
font-size: 70%;
}
*{
box-sizing: border-box;
}
.center {
width:100%;
display: flex;
justify-content:center;
flex-wrap:wrap;
}
h1{
text-align: center;
color: #104723;
top: -10px;
}
<h1>The Topic</h1>
<div class="center">
<div class="img_container">
<a href="/ACControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Access Control (AC)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/IAControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Identification & Authentication (IA)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/MPControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Media Protection (MP)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/PEControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">Physical Protection (PE)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/SCControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">System & Communications Protection (SC)</span>
</div>
</a>
</div>
<div class="img_container">
<a href="/SIControls.aspx" class="btn">
<div class="background">
<img class="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Angular_one_color_inverse_logo.svg/1024px-Angular_one_color_inverse_logo.svg.png" alt="logo" />
<span class="text">System & Information Integrity (SI)</span>
</div>
</a>
</div>
</div>
One Important thing - In your code snippet in the HTML you have declared a <h1> heading at the top inside a <head> tag. Pls don't do this <head> tag is always used outside the <body> element that too to declare meta data which doesn't supposed to be visible in the browser. Their are other semantic tags to use inside the <body> element and I think you might have got confused with <header> tag which can be used inside the <body> element.
Do tell me whether I was of any Help :)

I don't know why my images won't show up?

I am making myself a digital cv, and I can't get my images to show up on one of the pages.
The CSS and the HTML you can copy and use. Everything is working expect the images showing up, and I cannot understand why this is happening.
function openNav() {
document.getElementById("hamburger").style.display = "block";
}
function closeNav() {
document.getElementById("hamburger").style.display = "none";
}
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
padding: 20px;
font-family: Crown Title;
}
h3 {
font-size: 30px;
}
.main {
max-width: 1500px;
margin: auto;
}
h1 {
font-size: 50px;
word-break: break-all;
}
.row {
margin: 8px-16px;
}
img {
background-color: none;
}
.content {
background-color: none;
padding: 15px;
}
.column {
float: left;
width: 50%;
}
#media screen and (max-width:900px) {
.column {
width: 50%
}
}
#media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
<div id="hamburger" class="sidenav">
×
Home
My Story
Career
Education
Portfolio
Contact Us
<img alt="logo" src="https://us.123rf.com/450wm/krisdog/krisdog1709/krisdog170900122/85720771-stock-vector-lion-standing-rampant-heraldic-crest-coat-of-arms.jpg?ver=6">
</div>
<!--Burger Icon-->
<span style="font-size 30px; cursor: pointer" onclick="openNav()">☰</span>
<div class="main">
<!--Main Photo-->
<h1>See The World Through My Eyes</h1>
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQYOECNfDLyTYX5rEW8lFdhjTknabIrOH5amCPJYYIfWOFvNVLK&usqp=CAU" alt="happy" style="width:100%">
<h3>Wedding</h3>
</div>
<!--Table Grid smaller Photos-->
<div class="row">
<div class="column">
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTMejgEW9M5tYts8sPMXHj67KOW5_uzT2qR9A0gwpi660qqYVRD&usqp=CAU" alt="colors" style="width: 100%; height:50%">
<h3>Architecture</h3>
</div>
</div>
<div class="column">
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR0rBotboUlDoTFx1iX0FsXpt4Z4VbvA_5E34b-jG1BSQqtJ6yO&usqp=CAU" alt="animals" style="width:100%">
<h3>Animals</h3>
</div>
</div>
<div class="column">
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSVA6mUCorGmSCDsSY4qwZvG_CTbmh_N0db-4a_Z1HDcd25ulZR&usqp=CAU" alt="my_love" style="width:100%, height:50%">
<h3>Portrait</h3>
</div>
</div>
<div class="column">
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRowQXo7erqtYGz-3pOsPVLcD-baQ4Cyz1RUH5e30tUtS0crWFY&usqp=CAU" alt="my_loves_handmande_food" style="width:100%"></img>
<h3>Bento Box(M)</h3>
</div>
</div>
</div>
<div class="content">
<img src="https://i.pinimg.com/originals/16/58/bc/1658bcc4bc5a3976845372f7f8eddd00.jpg" alt="actually_Katsu_Dragneel" style="width:100%"></img>
<h3>Next Generation</h3>
</div>

Video section design not aligned

I am working to make video section look like something similar to below design
i am facing two design breaks in the right side
thumbnail doesn't fill the "vp-hqdefault-w" it shows part of image and rest of it is hidden.
second i am not able to align video title next to thumbnail as show in image
<div class="container">
<div class="row content">
<div class="col-md-7 col-sm-6">
<div class="active-iframe-wrapper video-embed-container">
<iframe id='activeIFrame' class='active-iframe' width='100%' height='324' src="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1" ></iframe>
</div>
<p>Title of the video</p>
</div>
<div class="col-md-5 col-sm-6">
<a class="" href="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/SCRUg5s389Q/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road One</h3>
</div>
</a>
<a class="" href="http://www.youtube.com/embed/QThP5kDUJJ0?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/QThP5kDUJJ0/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Two</h3>
</div>
</a>
<a class="" href="http://www.youtube.com/embed/xIOP1PLjUTs?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/xIOP1PLjUTs/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Three</h3>
</div>
</a>
</div>
</div>
Codepen link
I am trying to make it responsive to it doesnt break
You are having this issue because you didn't add float:left property to the video thumnail div. Try this code.
.vp-video-img-w {
position: relative;
overflow: hidden;
float: left;
margin-right: 10px;
width: 30%;
}
Try below code:
.header {
padding-top: 20px;
padding-bottom: 20px;
}
.video-embed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
margin-bottom: 0px;
}
.active-iframe-wrapper {
float: left;
width: 100%;
background-color: #f5f5f5;
}
.video-embed-container iframe, .embed-container object, .embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-item-w{
background-color:#ccc;
}
.vp-hqdefault-w {
max-height: 80px;
max-width: 120px;
overflow: hidden;
position: relative;
width:30%;
}
.vp-video-img-w {
position: relative;
width: 30%;
overflow: hidden;
float: left;
}
.vp-video-details{
width:70%;
float:left;
}
.vp-video-img-w img {
max-width: 100%;
}
.video-thumbnail:after {
content: '';
display: block;
clear:both;
}
.footer {
border-top: 1px solid #444;
padding-top: 20px;
margin-top: 20px;
color: #999
}
.p {
text-align: center;
padding-top: 120px;
}
.p a {
text-decoration: underline;
color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row content">
<div class="col-md-7 col-sm-6">
<div class="active-iframe-wrapper video-embed-container">
<iframe id='activeIFrame' class='active-iframe' width='100%' height='324' src="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1" ></iframe>
</div>
<p>Title of the video</p>
</div>
<div class="col-md-5 col-sm-6">
<a class="video-thumbnail" href="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/SCRUg5s389Q/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road One</h3>
</div>
</a>
<a class="video-thumbnail" href="http://www.youtube.com/embed/QThP5kDUJJ0?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/QThP5kDUJJ0/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Two</h3>
</div>
</a>
<a class="video-thumbnail" href="http://www.youtube.com/embed/xIOP1PLjUTs?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/xIOP1PLjUTs/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Three</h3>
</div>
</a>
</div>
</div>
Change
.vp-video-img-w {
position: relative;
width: 100%;
overflow: hidden;
}
to
.vp-video-img-w {
position: relative;
width: 100%;
overflow: hidden;
float: left;
}

Create layout HTML with different div with different height

I would like to create a layout with divs with different height.
Example image:
I would like even that div can change the height based on the content.
In my code, I put a fixed height for the div so I want to modify it but I don't know how.
This is my code:
HTML
<div>
<div class="g-block-1">
<div class="block1"></div> <div class="block2"></div>
</div>
<div class="g-block-2">
<div class="block3"></div>
<div class="block4"></div>
<div class="block5"></div>
</div>
</div>
CSS
.block1 {
width: 100%;
height: 500px;
background-color: red;
}
.block2 {
width: 100%;
height: 350px;
background-color: yellow;
}
.block3 {
width: 100%;
height: 100px;
background-color: blue;
}
.block4{
width: 100%;
height: 350px;
color: black;
}
.block5 {
width: 100%;
height: 400px;
color: pink;
}
.g-block-1 {
width: 50%;
float: left;
}
.g-block-2 {
width: 50%;
float: right;
}
Something like this?
https://jsfiddle.net/scorpio777/wwwLmvfu/
<style>
pre {margin:0 padding:0;}
.block1 {
width: 100%;
height: 100%;
border:1px solid;
border-color:red;
margin:0;
padding:0;
}
.block2 {
width: 100%;
height: 100%;
border:1px solid;
border-color:orange;
margin:0;
padding:0;
}
.block3 {
width: 100%;
height: 100%;
border:1px solid;
border-color:blue;
margin:0;
padding:0;
}
.block4{
width: 100%;
height: 100%;
border:1px solid;
border-color:green;
margin:0;
padding:0;
}
.block5 {
width: 100%;
height: 100%;
border:1px solid;
border-color:pink;
margin:0;
padding:0;
}
.g-block-1 {
width: 50%;
height:100%;
float: left;
display:inline-block;
margin:0;
padding:0;
}
.g-block-2 {
width: 50%;
float: right;
height:100%;
display:inline-block;
margin:0;
padding:0;
}
}
</style>
<div>
<div class="g-block-1">
<div class="block1">
<pre>
some content
some content
some content
some content
some content
some content
some content
some content
</pre>
</div>
<div class="block2">
<pre>
some content
some content
some content
some content
some content
some content
some content
some content
some content
some content
</pre>
</div>
</div>
<div class="g-block-2">
<div class="block3">
<pre>
some content
some content
some content
some content
some content
</pre>
</div>
<div class="block4">
<pre>
some content
some content
some content
some content
some content
</pre>
</div>
<div class="block5">
<pre>
some content
some content
some content
some content
some content
</pre>
</div>
</div>
</div>
You can try this responsive solution:
* {box-sizing: border-box}
body {margin: 0}
#container {
width: 1200px;
max-width: 100%;
margin: 0 auto;
}
.items {
column-count: 3;
column-gap: 10px;
}
.item {
margin-bottom: 10px;
page-break-inside: avoid;
break-inside: avoid-column;
}
img {
display: block;
max-width: 100%;
}
#media (max-width: 1220px) {
.items {padding: 0 10px}
}
#media (max-width: 990px) {
.items {column-count: 2}
}
#media (max-width: 500px) {
.items {column-count: 1}
}
<div id="container">
<section class="items">
<div class="item">
<img src="http://www.nowphuket.com/wp-content/uploads/2014/09/layan-beach-550x400.jpg" alt="">
</div>
<div class="item">
<img src="https://www.globotreks.com/wp-content/uploads/2017/06/Redding-Nature-600x450.jpg" alt="">
</div>
<div class="item">
<img src="http://liveinlosgatosblog.com/wp-content/uploads/2015/08/Shannon-Valley-Ranch-open-space-trail-650x500.jpg" alt="">
</div>
<div class="item">
<img src="http://www.9corerealty.com/wp-content/uploads/2016/03/Collier-County-4-700x550.jpg" alt="">
</div>
<div class="item">
<img src="http://webbox.imgix.net/images/aisrvqxbdirtzdby/c141a47e-bdd2-4687-a795-61141548c195.jpg?auto=enhance,compress&fit=crop&w=750&h=600" alt="">
</div>
<div class="item">
<img src="http://colonialbrickandstone.com/colonialwp/media/manitoulin-island-view-800x650.jpg" alt="">
</div>
<div class="item">
<img src="http://all-that-is-interesting.com/wordpress/wp-content/uploads/2013/08/secret-gardens-kirstenbosch-2.jpg" alt="">
</div>
<div class="item">
<img src="http://www.thinkslovenia.com/upload/area_guides/south_top_10/kolpa.jpg" alt="">
</div>
<div class="item">
<img src="https://www.viaventure.com/wp-content/uploads/450x300-Lamanai03.jpg" alt="">
</div>
<div class="item">
<img src="http://webbox.imgix.net/images/aisrvqxbdirtzdby/c141a47e-bdd2-4687-a795-61141548c195.jpg?auto=enhance,compress&fit=crop&w=750&h=600" alt="">
</div>
<div class="item">
<img src="http://colonialbrickandstone.com/colonialwp/media/manitoulin-island-view-800x650.jpg" alt="">
</div>
<div class="item">
<img src="http://all-that-is-interesting.com/wordpress/wp-content/uploads/2013/08/secret-gardens-kirstenbosch-2.jpg" alt="">
</div>
<div class="item">
<img src="http://www.thinkslovenia.com/upload/area_guides/south_top_10/kolpa.jpg" alt="">
</div>
<div class="item">
<img src="https://www.viaventure.com/wp-content/uploads/450x300-Lamanai03.jpg" alt="">
</div>
<div class="item">
<img src="https://www.fredericanaturereserve.com/wp-content/uploads/2016/08/500x350-px-F1-10.jpg" alt="">
</div>
<div class="item">
<img src="http://www.nowphuket.com/wp-content/uploads/2014/09/layan-beach-550x400.jpg" alt="">
</div>
<div class="item">
<img src="https://www.globotreks.com/wp-content/uploads/2017/06/Redding-Nature-600x450.jpg" alt="">
</div>
<div class="item">
<img src="http://liveinlosgatosblog.com/wp-content/uploads/2015/08/Shannon-Valley-Ranch-open-space-trail-650x500.jpg" alt="">
</div>
<div class="item">
<img src="http://www.9corerealty.com/wp-content/uploads/2016/03/Collier-County-4-700x550.jpg" alt="">
</div>
</section>
</div>

Gallery display horizontally with images with the same size

I'm working on HTML and CSS and I'm having a hard time aligning the images horizontally instead of vertically.
I tried displaying them inline-block and inline none of them works. And I also want my images to have the same sizes.
Here's my html code:
#gallery {
width: 500px;
overflow: hidden;
position: relative;
z-index: 1;
margin: 100px auto;
display: inline;
}
#gallery img {
width: 50%;
height: auto;
border: 5px solid #FFFFFF;
margin: 10px;
box-sizing: border-box;
margin: 0 auto;
padding: 0;
}
<div id="gallery">
<img src="images/gallery1.png">
<img src="images/gallery2.png">
<img src="images/gallery3.png">
<img src="images/gallery4.png">
<img src="images/gallery5.png">
<img src="images/gallery6.png">
<script src="lightbox2-master/dist/js/lightbox-plus-jquery.js"></script>
</div>
Try this:
div.gallery {
margin: 5px;
border: 1px solid #ccc;
float: left;
width: 180px;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
}
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
<div class="gallery">
<a href="images/gallery1.png" data-lightbox="image-1" data-title="Ian and Vee">
<img src="images/gallery1.png" width="600" height="400">
</a>
</div>
Simpler answer. Add a float to your image.
#gallery {
width: 500px;
overflow: hidden;
position: relative;
z-index: 1;
margin: 100px auto;
display: inline;
}
#gallery img {
float: left;
width: 50%;
height: auto;
border: 5px solid #FFFFFF;
margin: 10px;
box-sizing: border-box;
margin: 0 auto;
padding: 0;
}