Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@page {margins} relation images with 'position: absolute' #2020

Closed
SystemError7 opened this issue Dec 14, 2023 · 1 comment
Closed

@page {margins} relation images with 'position: absolute' #2020

SystemError7 opened this issue Dec 14, 2023 · 1 comment
Labels
CSS Questions about how to do something with CSS

Comments

@SystemError7
Copy link

Hi, ``````

I have images with absolute position in a div in order to have free move with them, also I have the following style in @ page:

    <style>
      @page {
        margin-top: 2.5cm;
        margin-left: 0cm;
        margin-right: 0cm;
        margin-bottom: 1cm;
        size: A4 landscape;
      }
    </style>

I've expected that the images with position: absolute | fixed won't be affected by the @page margins.

I try with

    @top-left {
        content: element(header)
    }

and it fixed in a certain way, because using that method, it doesn't apply the margin, but the images appear in all the pages.

There's a way to have the images with 'position: absolute' without affection of the @page margin?

What I expect:

image

The result:

image

@liZe
Copy link
Member

liZe commented Dec 14, 2023

Hi!

I've expected that the images with position: absolute | fixed won't be affected by the @page margins.

According to the specification, absolute and fixed elements are positioned relatively to the page area, which doesn’t include page margins.

If you want to put absolutely positioned images in the margins, you can use negative values for top/bottom/left/right. You can also set them as background of page margin boxes, or as background of the page (#1993 may be interesting to read, the fix is not included yet in a released version.)

@liZe liZe added the CSS Questions about how to do something with CSS label Dec 14, 2023
@liZe liZe closed this as completed Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Questions about how to do something with CSS
Projects
None yet
Development

No branches or pull requests

2 participants