Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-anchor-position/pseudo-element-implicit-anchor-center.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Anchor Positioning: Originating element implicit anchor for pseudo elements using anchor-center</title>
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html">
<style>
#anchor {
display: flow-root;
margin-left: -50px;
margin-top: -50px;
width: 200px;
height: 200px;
}
#anchor::after {
content: "";
position: absolute;
width: 100px;
height: 100px;
background: green;
/* Should be centered inside #anchor */
place-self: anchor-center;
}
#ref {
margin-left: 50px;
margin-top: 50px;
width: 100px;
height: 100px;
background-color: red;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div id="wrapper">
<div id="anchor">
<div id="ref"></div>
</div>
</div>