0

as you can read from the title I have a problem with placing 1 DIV Container and an Image inside inside a DIV container.

* {
  margin: 0;
  padding: 0;
  border: 0;
}

.placeholder {
  height: 200px width: 100px;
  background-color: blue;
}

#thumb_container {
  width: 500px;
  height: 500px;
  margin: auto;
  background-color: #333;
}

#thumb_container > ul {
  list-style-type: none;
}

#thumb_container > ul > li {
  display: inline-block;
  background-color: #777;
}

.thumb_box {
  width: 100%;
  background-color: blue;
  position: relative;
}

.thumb_info {
  width: 100%;
  background-color: yellow;
  opacity: .5;
  position: absolute;
  bottom: 0;
}
<div id="thumb_container">
  <ul>
    <li>
      <div class="thumb_box">
        <img src="http://i.imgur.com/MussUUm.jpg">
        <div class="thumb_info">
          Test
        </div>
      </div>
    </li>
    <ul>
</div>

jsfiddle

It almost works except the blue DIV .thumb_box, which is supposed to hold the image and the other DIV .thumb_info together is slightly too big and I don't know why. I can't figure out why it's expending.

Marc Audet
  • 46,011
  • 11
  • 63
  • 83
Ne0nfire
  • 1
  • 1
  • 3
    Welcome to Stack Overflow! Questions seeking debugging help must include the shortest code necessary to reproduce it **in the question itself.** NB - **Please don't abuse the code blocks to get around this requirement**. – Paulie_D Oct 22 '15 at 10:23
  • ... and read [how to ask a good question](http://stackoverflow.com/help/how-to-ask) – Wavemaster Oct 22 '15 at 10:26
  • Thanks for editing, didn't know excactly what you meant. <3 – Ne0nfire Oct 22 '15 at 10:29
  • 1
    @t.niese Thank you so much! I didn't know that the image was the problem, I thought it had something to do with the position of the two elements! I fixed it by setting display:block at the image Tag. Can't believe that this was the problem.. thank you and sorry for asking such a weird written question. – Ne0nfire Oct 22 '15 at 10:35
  • The problem is related to the image ( [Remove white space below image](http://stackoverflow.com/questions/7774814/remove-white-space-below-image)), but It is not an exact duplicate. The actual problem is the combination of the image being inline, and the position `absolute` of the element. – t.niese Oct 22 '15 at 10:36

1 Answers1

0

I guess:

img {
    display: block;
}
Jeroen Bellemans
  • 2,049
  • 2
  • 25
  • 42