Jump to content


Photo

height problem


  • Please log in to reply
1 reply to this topic

#1 dianikol85

dianikol85

    Advanced Member

  • Member
  • PipPipPipPip
  • 126 posts

Posted 04 April 2011 - 06:56 AM

Hi to all. This is the situation. I have this piece of hmtl


<div id='wrap'>
  
  <div class='image'>
    <img src='images/1.jpg' />
  </div>

  <div class='image'>
    <img src='images/2.jpg' />
  </div>

  <div class='image'>
    <img src='images/3.jpg' />
  </div>

</div>



what i need is that the height of the div#wrap must has the height of the inner div.image.

I can't give a fixed value to the height because the div.image is going to have different height from time to time. So i need the div#wrap's height to asjust dynamically according to the div.image.

For example:

The images i will display today they all have height:100px;

Tomorrow they will have 200px; and so on.

How i should do it??

Tanks
  • 0

#2 Andrea

Andrea

    Advanced Member

  • Moderators
  • 5,730 posts
  • Facebook:https://www.facebook.com/aandbwebdesignAB
  • LocationSan Antonio, TX

Posted 04 April 2011 - 07:00 AM

For starters, you really don't need the div class="image" divisions. If you are applying some css to the image, you can do so via #div img.

Then, your wrap division will automatically be as big as its content, so setting a height is not even an issue. If you do have some space in there you don't want, make sure padding of the wrap div and that and the margins of the images inside are zero.

That should do it, I think.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users