Jump to content
Stef's Coding Community
Sign in to follow this  
dianikol85

height problem

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...