How can I make a div take up the width or height of a parent without knowing the parent?

Viewed 27

I am supposed to create a reusable component which always takes up the available space of the parent, which means I cannot modify the parent only the component itself. Normally I would just set the parent's position to relative, and the child's one to absolute for this, but in this case I'm not able to modify the parent container.

Do you have any suggestions to solve this?

<div class="anyParent">
  <div class="otherstuff">
    content
  </div>
  <div class="reusableComponent">
    <svg class="i_want_to_be_fullsize">
  </div>
0 Answers
Related