Is it possible to stretch the container of the absolutely positioned div'AMI inside height in the css?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
10 views
Hi all.
There is a html template with absolutely positioned container and divas in it:










div#first or div#second have position:absolute, with rigidly specified left and top. (well, for example, top:2000px).
Is it possible with css (not javscript'om) to stretch the container to its maximum height?
I understand that a div with position:absolute in theory should be invisible to the container, however, when the above-described construction, the height of the page expands, and the scrollbar appears.

And so, again in short: is it possible to stretch the container with absolutely positioned inside the divas to the maximum height (that it would fit all of the diva) in your css?
by | 10 views

5 Answers

0 like 0 dislike
"that it would fit all of the diva": you're right at the beginning wrote that "div with position:absolute in theory should be invisible to container", ie the container is not adjusted to the absolute diva. Here's an example adminimus'a first and a second panel will not be visible unless you specify
\rhtml, body{margin:0; height:100%;}. And all because the height will be 0, and overflow:hidden will hide all of the container (but if we hadn't pointed out the container position:relative;, absolute diva positioned in the body and would be visible). If you still need that the container will adjust to children, then absolute positioning will not work. Would you describe in more detail the problem and the desired result.
by
0 like 0 dislike
Not quite sure what you ultimately need. Something like this?
\r
.container { background-color: grey; height: 100%; overflow: hidden; position: relative; width: 200px; } .first { left: 10px; position: absolute; top: 10px; } .second { left: 20px; position: absolute; top: 400px; } 
by
0 like 0 dislike
The scroll bar from the browser window an exception. In the General case for absolutely positioned elements are taken out of the flow and the height of the parent unit can not influence.
by
0 like 0 dislike
Just in case: manipulate z-index’om it is possible not only in absolute (position: absolute) but relative (position: relative) positioning.
by
0 like 0 dislike
to z-index correctly worked, we need to set positioning and z-index all items in a branch of nesting..

all in all, the positioning of the elements is not badly written here: css position
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 14, 2019 by sidorchik
0 like 0 dislike
5 answers
110,608 questions
257,186 answers
0 comments
28,140 users