2

My inner image should have the same height as the outer div.

My code is:

<div>
   <div class="col_2_fifth">
      <figure>
         <img src="....." />
      </figure>
   </div>
   <div class="col_3_fifth">
      <div class="description">
          <p>....</p>
      </div>
   </div>
</div>

But the image height is always less than its parent div height.

What can i do now? Can i fix this with jquery/js or with css?

Stephan Weinhold
  • 1,623
  • 1
  • 28
  • 37
Musa Muaz
  • 714
  • 2
  • 11
  • 29

7 Answers7

0

simply write:

figure img {height:100%:}
Richa
  • 4,240
  • 5
  • 33
  • 50
0
<div>
   <div class="col_2_fifth" style='width:20%'>
      <figure>
         <img src="123.jpg-17eqp8a.jpg" width='100%' />
      </figure>
   </div>
   <div class="col_3_fifth">
      <div class="description">
          <p>....</p>
      </div>
   </div>
</div>

try this

Akhila Prakash
  • 481
  • 4
  • 17
0

You may add

img {
  vertical-align: top;
}
marsh
  • 1,431
  • 1
  • 13
  • 19
0

Try editing the css file responsible for the col_2_fifth and col_3_fifth. That will help you in resolving the issue.

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
shravan
  • 11
  • 4
0
.col_2_fifth {
padding : 0px;
margin: 0px;
}

Try this.

Pratik
  • 1,122
  • 8
  • 26
0

Try with CSS:

 .col_2_fifth {
      background: url(123.jpg-17eqp8a.jpg);
      background-size: 100% 100%;
 }

This wil set the image as background for the div with the class col_2_fifth

link in comment from Luthando Loot is best solution

Ignotus
  • 301
  • 1
  • 10
0

This should work:

.col_2_fifth, figure, figure img {
    padding: 0;
    margin: 0;
}

.col_2_fifth, figure img {
    height: 100%;
}