- From: 一丝 via GitHub <noreply@w3.org>
- Date: Tue, 28 Oct 2025 03:49:53 +0000
- To: public-css-archive@w3.org
If only `anchor()` is set, is it also necessary to reset the margin to 0?
```html
data:text/html;charset=UTF-8,<!DOCTYPE html>
<style>
.anchor {
anchor-name: --foo;
width: 50px;
height: 50px;
margin: 30px 100px;
background-color: lightgreen;
text-align: center;
}
.tooltip {
background-color: pink;
width: 100px;
border: none;
position: absolute;
position-anchor: --foo;
/* Currently, you must set `margin: 0` to center anchored elements. */
margin: auto;
top: anchor(bottom);
left: anchor(center);
transform: translateX(-50%);
}
</style>
<button class="anchor" popovertarget="tooltip">Click me</button>
<div class="tooltip" id="tooltip" popover>tooltip</div>
```
--
GitHub Notification of comment by yisibl
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10258#issuecomment-3454409514 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 28 October 2025 03:49:54 UTC