Element position fixed is related to parent instead to the viewport

Cuzi

trying to achieve:

position element in fixed right and top relative to the viewport

what I am doing:

  • set position: fixed; to the element

  • calculate the right and the top related and set it on the element

what happen?

  • element any where is act as i wanted

  • but Element with the same styling (fixed position and right & top) in modal get positioned relative to he's parent (it's happen on bootstrap modal)

code example element style:

.fixed-floater {
  top: 300px;
  right: 151px;
  text-align: left;
  display: block;
  min-width: 180px;
  position: fixed;
  z-index: 999;
  padding: 4px;
}

images: http://s3.postimg.org/u2kraeyzn/modal_error.png

Cuzi

what happen (as i understand)

modal container has (from bootstrap) defaults of transform: translate(0, 0);

by the w3 specification :

element with position:fixed are always relative to the initial containing block.

W3 Wiki

Some values of these properties result in the creation of a containing block

and

For elements whose layout is governed by the CSS box model, any value other than none for the transform results in the creation of both a stacking context and a containing block. The object acts as a containing block for fixed positioned descendants. W3 Transform Specification

So by the mentioned above, the Translate transform is setting the modal as "the initial containing block" for the fixed element inside him instead of the body.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Position fixed within container element instead of the browser / viewport

From Dev

Position fixed within container element instead of the browser / viewport

From Dev

Pin element like position: fixed but inside its parent not the viewport

From Dev

css "fixed" child element positions relative to parent element not to the viewport, why?

From Dev

Bootstrap: Element with position fixed inside modal not aligned with respect to the viewport

From Dev

Position fixed relative to a block, not to the viewport

From Dev

Make position: fixed element respect parent with position: relative

From Dev

Make position: fixed element respect parent with position: relative

From Dev

How to position a child element at the bottom of a fixed position parent

From Dev

scroll property in a child element of a parent div whose position is fixed

From Dev

CSS position fixed div still displayed in respect to parent element

From Dev

How to set a div percentage width with a fixed position based on the parent element

From Dev

Keep element position fixed to parent using transform on scroll

From Dev

Position fixed 100 of parent

From Dev

Get element position in viewport as percentage

From Dev

Fixed div related to its parent

From Dev

Position:fixed element within a position:relative parent. Which browser renders correctly?

From Dev

Get position relative to parent not viewport on mousedown / touchstart

From Dev

Position a fixed element below another fixed element

From Dev

Detect whether an element has position:fixed (possibly by parent element) via jQuery

From Dev

Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

From Dev

Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

From Dev

Fixed position relative to parent container

From Dev

Fixed position element inside absolute position element

From Dev

Fixed position element inside absolute position element

From Dev

Get an element position relative to the top of the viewport

From Dev

Fixed element positioned relative to the viewport(left) and static element (right)

From Dev

Fixed element positioned relative to the viewport(left) and static element (right)

From Dev

How to make a fixed-position element inside a clip-path parent stay above all elements?

Related Related

  1. 1

    Position fixed within container element instead of the browser / viewport

  2. 2

    Position fixed within container element instead of the browser / viewport

  3. 3

    Pin element like position: fixed but inside its parent not the viewport

  4. 4

    css "fixed" child element positions relative to parent element not to the viewport, why?

  5. 5

    Bootstrap: Element with position fixed inside modal not aligned with respect to the viewport

  6. 6

    Position fixed relative to a block, not to the viewport

  7. 7

    Make position: fixed element respect parent with position: relative

  8. 8

    Make position: fixed element respect parent with position: relative

  9. 9

    How to position a child element at the bottom of a fixed position parent

  10. 10

    scroll property in a child element of a parent div whose position is fixed

  11. 11

    CSS position fixed div still displayed in respect to parent element

  12. 12

    How to set a div percentage width with a fixed position based on the parent element

  13. 13

    Keep element position fixed to parent using transform on scroll

  14. 14

    Position fixed 100 of parent

  15. 15

    Get element position in viewport as percentage

  16. 16

    Fixed div related to its parent

  17. 17

    Position:fixed element within a position:relative parent. Which browser renders correctly?

  18. 18

    Get position relative to parent not viewport on mousedown / touchstart

  19. 19

    Position a fixed element below another fixed element

  20. 20

    Detect whether an element has position:fixed (possibly by parent element) via jQuery

  21. 21

    Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

  22. 22

    Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

  23. 23

    Fixed position relative to parent container

  24. 24

    Fixed position element inside absolute position element

  25. 25

    Fixed position element inside absolute position element

  26. 26

    Get an element position relative to the top of the viewport

  27. 27

    Fixed element positioned relative to the viewport(left) and static element (right)

  28. 28

    Fixed element positioned relative to the viewport(left) and static element (right)

  29. 29

    How to make a fixed-position element inside a clip-path parent stay above all elements?

HotTag

Archive