Width, height at position absolute?

There is a block div1, inside it is another set div2.
At div2 with position absolute, when setting width: 100%; height: 100%;
the height and width of div2 is taken from the browser screen, not the parent element div1, how to make div2 have was position absolute and width and height 100% of parent element.
July 8th 19 at 11:19
2 answers
July 8th 19 at 11:21
Add to div1 position: relative;
July 8th 19 at 11:23
1. absolute or relative to fixed indented to replace
2. JS
it is better to give an example as it is now jsfiddle.net
and how to do...

Find more questions by tags CSS