How can I expand a child div height to parent height?

Viewed 9239

I have 2 divs aligned on the same line, separated by a vertical line and I want that line to always have the height of parent div.

I tried to implement all solutions found but none of them works (can't use position:absolute, and display:table or overflow:hidden on parent have no effect).

JSFIDDLE

This is my code:

HTML:

<div class="parent-div">
  <div class="first-child">
    <span class="block">Item</span>
    <span class="block">Item</span>
    <span class="block">Item</span>
  </div>
  <div class="second-child">
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span>
    <span class="block">Content here</span> 
  </div>
</div>

CSS:

.parent-div {
  background:green;
  display: inline-block;
  width: 100%;
}

.first-child,
.second-child {
  float: left;
}

.first-child {
  width: 50px;
  border-right: 2px solid red;
}

.second-child {
  padding-left: 10px;
}

.block {
  display: block;
}
2 Answers
Related