Hello guys,
i`m very new to html and css and i`m trying to create a website, but i cannot figure out how to remove the gaps between 1st and second row picture. I plan to have different type of picture sizes like in the example, but I would like them to "HUG" eachother.
Is there anyone who could help me with this?
I`m adding screenshot of what I mean, my html and css files. If anyone has any better solutions to that what i`m doing right now, please let me know, I will appreciate every help!
Thank you,
Raitis
HTML
CSS
i`m very new to html and css and i`m trying to create a website, but i cannot figure out how to remove the gaps between 1st and second row picture. I plan to have different type of picture sizes like in the example, but I would like them to "HUG" eachother.
Is there anyone who could help me with this?
I`m adding screenshot of what I mean, my html and css files. If anyone has any better solutions to that what i`m doing right now, please let me know, I will appreciate every help!
Thank you,
Raitis
HTML
Code:
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website Layout</title>
<link rel="stylesheet" href="h3c.css">
</head>
<body>
<header>
<div class="logo">Logo</div>
<nav>
<ul>
<li><a href="#">Button 1</a></li>
<li><a href="#">Button 2</a></li>
<li><a href="#">Button 3</a></li>
</ul>
</nav>
<div class="social-icons">
<a href="#"><img src="twitter-icon.png" alt="Twitter"></a>
<a href="#"><img src="facebook-icon.png" alt="Facebook"></a>
<a href="#"><img src="instagram-icon.png" alt="Instagram"></a>
</div>
</header>
<section class="strip">
<div class="strip-content">
<div>Text</div>
<div>Text</div>
<div>Text</div>
</div>
</section>
<section class="image-gallery">
<div class="image">
<img src="https://via.placeholder.com/120x120" alt="Image 1">
</div>
<div class="image">
<img src="https://via.placeholder.com/140x180" alt="Image 2">
</div>
<div class="image">
<img src="https://via.placeholder.com/120x200" alt="Image 3">
</div>
<div class="image">
<img src="https://via.placeholder.com/200x200" alt="Image 4">
</div>
<div class="image">
<img src="https://via.placeholder.com/100x200" alt="Image 5">
</div>
<div class="image">
<img src="https://via.placeholder.com/200x100" alt="Image 6">
</div>
<!-- Add more images with different sizes as needed -->
<div class="image">
<img src="https://via.placeholder.com/150x150" alt="Image 7">
</div>
<div class="image">
<img src="https://via.placeholder.com/180x120" alt="Image 8">
</div>
<div class="image">
<img src="https://via.placeholder.com/160x220" alt="Image 9">
</div>
<div class="image">
<img src="https://via.placeholder.com/180x180" alt="Image 10">
</div>
<div class="image">
<img src="https://via.placeholder.com/130x170" alt="Image 11">
</div>
<div class="image">
<img src="https://via.placeholder.com/170x130" alt="Image 12">
</div>
<div class="image">
<img src="https://via.placeholder.com/190x160" alt="Image 13">
</div>
<div class="image">
<img src="https://via.placeholder.com/140x140" alt="Image 14">
</div>
<div class="image">
<img src="https://via.placeholder.com/200x180" alt="Image 15">
</div>
<div class="image">
<img src="https://via.placeholder.com/180x200" alt="Image 16">
</div>
<div class="image">
<img src="https://via.placeholder.com/150x190" alt="Image 17">
</div>
<div class="image">
<img src="https://via.placeholder.com/170x150" alt="Image 18">
</div>
<div class="image">
<img src="https://via.placeholder.com/160x130" alt="Image 19">
</div>
<div class="image">
<img src="https://via.placeholder.com/200x160" alt="Image 20">
</div>
<div class="image">
<img src="https://via.placeholder.com/190x170" alt="Image 21">
</div>
</section>
<footer>
Footer text
</footer>
</body>
</html>
CSS
Code:
/* Reset default browser styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
line-height: 1.6;
}
header {
background-color: #333;
color: white;
padding: 10px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
nav ul li {
margin-right: 10px;
}
nav ul li a {
color: white;
text-decoration: none;
padding: 8px 12px;
transition: background 0.3s;
}
nav ul li a:hover {
background-color: #555;
}
.social-icons {
display: flex;
}
.social-icons a {
margin-left: 10px;
}
.strip {
background-color: #ddd;
padding: 20px 0;
text-align: center;
}
.strip-content {
display: flex;
justify-content: space-around;
}
.image-gallery {
max-width: 1200px;
margin: 20px auto;
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 10px;
}
.image-gallery img {
width: 100%;
display: block;
border-radius: 5px;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 20px 0;
}
Last edited: