0

I'm trying to create some thumbnails although I encountered that during the CSS implementation the second thumbnail that I have is getting this space below, any hints how can I can make the image to the edge? I'm attaching a pic as a reference. The small thumbnail is the one that isn't going to the edge at the bottom, only of the top (yellow circle).

.projects {
  background-color: blue;
  background-size: cover;
  height: 100vh;
  width: 100%;
}

.projects h1 {
  padding: 12%;
  color: white;
  font-size: 44px;
  text-align: center;
  text-transform: uppercase;
  font-weight: bold;
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.col {
  flex-basis: 50%;
  min-width: 250px;
}

.feature-img {
  width: 83%;
  margin: auto;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.small-img-row {
  display: flex;
  background: white;
  margin: 20px 0;
  align-items: center;
  border-radius: 6px;
  overflow: hidden;
  width: 85%;
}

.small-img {
  position: relative;
}

.small-img img {
  width: 150px;
}

.small-img-row p {
  margin-left: 20px;
  color: #707070;
  line-height: 22px;
  font-size: 18px;
}
<div class="projects" id="projects">
  <h1>Check out my projects</h1>
  <div class="row">
    <div class="col">
      <div class="feature-img">
        <img src="https://anongamez.com/wp-content/uploads/2019/03/caratula-dead-space-2-400x650.jpg" width="100%">
      </div>
    </div>

    <div class="col">
      <div class="small-img-row">
        <div class="small-img">
          <img src="https://media.hswstatic.com/eyJidWNrZXQiOiJjb250ZW50Lmhzd3N0YXRpYy5jb20iLCJrZXkiOiJnaWZcLzUtcG9zdC1zaHV0dGxlLTIuanBnIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoyNTB9fX0=">
        </div>
        <p>Este es un texto de<br>prueba funciona perro<br></p>
      </div>
    </div>

  </div>
</div>

Reference

Jon P
  • 19,442
  • 8
  • 49
  • 72
JobV
  • 23
  • 4
  • I did a bit of debugging, and it looks like that `.small-img` is to blame. – no ai please Jan 06 '22 at 00:38
  • Does this answer your question? [Remove white space below image](https://stackoverflow.com/questions/7774814/remove-white-space-below-image). Short answer: `img { display: block; }` – no ai please Jan 06 '22 at 00:47
  • Thank you so much @Someone_who_likes_SE it work! Best regards :) – JobV Jan 06 '22 at 00:51

1 Answers1

2

Apply display: block to .small-img img (the default is baseline, which causes the space below the image)

body {
  background-color: blue;
}
.projects {
  background-color: blue;
  background-size: cover;
  height: 100vh;
  width: 100%;
}

.projects h1 {
  padding: 12%;
  color: white;
  font-size: 44px;
  text-align: center;
  text-transform: uppercase;
  font-weight: bold;
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.col {
  flex-basis: 50%;
  min-width: 250px;
}

.feature-img {
  width: 83%;
  margin: auto;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.small-img-row {
  display: flex;
  background: white;
  margin: 20px 0;
  align-items: center;
  border-radius: 6px;
  overflow: hidden;
  width: 85%;
}

.small-img {
  position: relative;
}

.small-img img {
  width: 150px;
  display: block;
}

.small-img-row p {
  margin-left: 20px;
  color: #707070;
  line-height: 22px;
  font-size: 18px;
}
<div class="projects" id="projects">
  <h1>Check out my projects</h1>
  <div class="row">
    <div class="col">
      <div class="feature-img">
        <img src="https://anongamez.com/wp-content/uploads/2019/03/caratula-dead-space-2-400x650.jpg" width="100%">
      </div>
    </div>

    <div class="col">
      <div class="small-img-row">
        <div class="small-img">
          <img src="https://media.hswstatic.com/eyJidWNrZXQiOiJjb250ZW50Lmhzd3N0YXRpYy5jb20iLCJrZXkiOiJnaWZcLzUtcG9zdC1zaHV0dGxlLTIuanBnIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoyNTB9fX0=">
        </div>
        <p>Este es un texto de<br>prueba funciona perro<br></p>
      </div>
    </div>

  </div>
</div>
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • It seems the image edge problem was solved, although it seems that for the other thumbnails that I have [3 small thumbnails], now those are totally off the layout. any hints? All thumbnails should be like in a vertical alignment [but not the big thumbnail] – JobV Jan 06 '22 at 01:54