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

[css-anchor-position-1][css-position] behavior of inset-area when no anchor is defined #10500

Open
Afif13 opened this issue Jun 26, 2024 · 1 comment

Comments

@Afif13
Copy link

Afif13 commented Jun 26, 2024

I just tried the below code:

.container {
  position: relative;
}
.element {
  position: absolute;
  inset-area: center;
  margin: auto;
}

And to my surprise, it center the absolute element. Demo: https://codepen.io/t_afif/pen/OJYwybK

Based on the Specification the propety applies to "positioned elements with a default anchor element". Does it mean that any positioned element has a default anchor which is its containing block?

If it's the correct behavior, I think the Spec should clarify the "default anchor" part. Or maybe this is a bug and inset-area should have no effect?

@kizu
Copy link
Member

kizu commented Jun 26, 2024

One thing I wonder about: should we relax this requirement, and if there is no default anchor, treat the containing block as one for this purpose?

From an author standpoint, nothing in inset-area says that there is some relation to the anchor, so it could be useful to allow using it without setting up the anchor itself to avoid confusion + cover some useful cases like the one @Afif13 mentions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants