Zed
Zed

Reputation: 5931

Setting the height of the child div with percents

I have a child div inside of parent div, something like this:

<div id="parent">
  <div id="child">

 </div>
</div>

Now, I would like to set height of the child, using percents, so it can be bigger than its content.Setting #child { height: 150% } won't accomplished nothing.Parent div doesn't have any height set, and I don't want to use pixels.So, the real question is, how to set child div bigger than its contents by using percents ?

EDIT: Maybe I was not clear.What I need is visual equivalent of this

#child{
  border: 1px solid black;
  height: 100px;
}

<div id="parent">
   <div id="child">
        <p>TESTING</p>
    </div>

using percents.

Upvotes: 0

Views: 44

Answers (2)

Debajyoti Das
Debajyoti Das

Reputation: 2138

This shoud be fine....

<div id="parent" style="overflow:auto;">
 <div id="child">

 </div>
</div>

Upvotes: 0

CodeMonk
CodeMonk

Reputation: 920

in css, add overflow parameter

#child{
    overflow:visible;
}

that should work for you.

Upvotes: 1

Related Questions