King Kong
King Kong

Reputation: 2915

Element`s absolute positioning issue

Is there any way to include the children elements size whose position is absolute into there parents size, i means to say :

We have :

MarkUP

        <div class="parent">
         <div class="children">
           My position is absolute.
         </div>
        </div>

CSS

         .parent      // position by default static
          {
            width:100%;
            height:auto;
          }

          .children
          {
            position :absolute;
            width:100%;
            height:auto;
          }

My problem is the height of parent is 0, may be because of its children absolute positioning. So is there any workaround for this?

Upvotes: 0

Views: 92

Answers (2)

Nickfmc
Nickfmc

Reputation: 379

Old post but someone might find this useful. if you are willing to use javascript

http://shinytoyrobots.com/2011/11/super-simple-jquery-height-manipulation/

Upvotes: 0

Moin Zaman
Moin Zaman

Reputation: 25465

Can you use JavaScript? Inman's position clearing method will do the job for you:

http://shauninman.com/assets/examples/si-clear-children-1.0/si-clear-children-1.0.zip

More info here: http://shauninman.com/archive/2006/05/22/clearance_position_inline_absolute

Upvotes: 1

Related Questions