ipf-backgroundattachment

Specifies whether a background image is fixed with respect to the viewport, or scrolls with the element.

  • Format: ipf-backgroundattachment(AttachmentType)

    AttachmentType can be scroll or fixed. If fixed is used together with ipf-backgroundposition on an element, the position is relative to the viewport and not the element.

    When multiple background images are used, each image layer can be positioned by using a tuple with the same length as the one used for the ipf-backgroundimage style. Each position value in the tuple then affects the image at the same position in the tuple used in the ipf-backgroundimage style. For example, if there are two background images used, ipf-backgroundattachment([scroll, fixed]) makes the first image scroll with the element and makes the second image fixed.

  • Default parameter value: scroll
  • Not inherited
  • Examples: ipf-backgroundattachment(fixed) on the window. (There are other styles used as well.) When scrolled at top:

    When scrolled down a bit, notice how the background stays in place: