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

Flex containers not positioned correctly when their margin-left/right is set to auto #2054

Open
alexandergitter opened this issue Feb 1, 2024 · 0 comments
Labels
bug Existing features not working as expected

Comments

@alexandergitter
Copy link
Contributor

alexandergitter commented Feb 1, 2024

In the following example, a flex container (the .inner div) has its margin-left and margin-right properties set to auto, which should cause it to be centered in its parent div. Instead, it is positioned at the left edge of the .outer div.
WeasyPrint does this correctly when the inner div gets changed to display: block.

(This may or may not be related to #1171, although that issues talks about nested flex containers, whereas in my case the outer container is a normal block element.)

<style>
  .outer {
    background: red;
  }
  
  .inner {
    margin: auto;
    display: flex;
    width: 10rem;
    height: 10rem;
    background: black;
  }
</style>

<div class="outer">
  <div class="inner"></div>
</div>

image

@liZe liZe added the bug Existing features not working as expected label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants