0

This is my first question, so please, be patient to me, thanks.

I am making website in wordpress. I have div which wraps content with image on left and some paragraph on right. And the background of transparent-box have height of the text (which is shorter), and ends in the middle of image (which is on left).

Here is my code:

<div class="transparent-box">
  <img class="alignleft" src="img/img.jpg" width="480" height="319" />
  <div class="tr-text">
    <p>some text</p>
  </div>
</div>

And style.css:

img.alignleft {
  float: left;
  margin-right: 30px;
}

.transparent-box {
  background: rgba(255,255,255,0.5);
  margin-top: 20px;
}

p {
line-height: 1.34;
margin-bottom: 14px;
font-size: 15px;

}

If I used it didn't helped me. I think the problem is easy to find solution, but I tried many ways which didn't work. I tried transparent-box auto or 100% height but it didn't work too.

Thank you so much!

3 Answers3

0

Hope this is what you want: Demo

HTML:

<div class="transparent-box">
    <img class="alignleft" src="img/img.jpg" width="480" height="319" />
    <div class="tr-text">
        <p>some text</p>
    </div>
    <div class="clear"></div>
</div>

CSS::

.clear{
    clear:both;        
}

You have float for img. So you need to clear float property in order to get full height

G.L.P
  • 7,119
  • 5
  • 25
  • 41
0

Adding display:inline-block for your .transparent-box?

R Lam
  • 393
  • 1
  • 13
0

Another solution :): Demo

overflow: hidden 

this cause the same effect as K.B.M's solution.