D
D
Denis2015-11-27 12:29:44
css
Denis, 2015-11-27 12:29:44

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

3 answer(s)
D
Dmitry Belyaev, 2015-11-27
@den0820

The child block must have position absolute

A
Anton Shamanov, 2015-11-27
@SilenceOfWinter

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;
}

K
Kirill Kublyakov, 2015-11-27
@Kublyakov

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 question

Ask a Question

731 491 924 answers to any question