Absolute positioning child and parent height is 0

Viewed 3721

It is a common question, but I still have not found any solution for my issue.

The .parent is a slider and the .child are images. I need pass .child height (which is an absolute-positioned element) to .parent.

.parent has 0px height. Any ideas?

Thanks in advance.

<div class="parent">
   <img class="child"></div> 
</div>

.child {
  position: absolute; //It must be absolute , because slider works with this
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
}
3 Answers

what could be the solution if the child is not an image rather the child is a div with unknown(auto) height because it needs accomodate for dynamic content ?

Related