Answer the question
In order to leave comments, you need to log in
Position fixed inside container block not working?
Hello. Faced the following problem regarding the fixed positioning of the block inside its parent. For example, I have a block that has position: fixed. Inside this block, there is also a block with the position: fixed property. But for a block - a child (located inside the parent), this property does not work. 100500 articles climbed, but never met a similar situation. Help me to solve the problem, please.
Answer the question
In order to leave comments, you need to log in
It is not very clear why this is needed, the tag with position: fixed is positioned relative to the screen, not the element. Just checked - everything seems to be fine.
<button class="btn btn-success" id="scroll-to-top" title="Наверх"><a class="btn">test</a></button>
#scroll-to-top {
position: fixed;
right: 10px;
bottom: 10px;
}
#scroll-to-top .btn {
position: fixed;
left: 10px;
bottom: 50px;
}
You probably need the nested block to be positioned depending on the parent.
Position fixed works on all blocks with any nesting, but positions the elements relative to the window, not the parent blocks.
Give the problem code, then it will become clearer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question