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/no-anchor-anchor-center.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>Tests that 'anchor-center' behaves as 'center' when no anchor in containing block</title>
<link rel="match" href="no-anchor-anchor-center-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center">
<style>
.anchor {
anchor-name: --dropdownAnchor;
background: orange;
width: 100px;
background-color: orange;
}
.container {
position: fixed;
top: 20px;
left: 50px;
width: 300px;
height: 200px;
background: green;
}
.target {
position-anchor: --dropdownAnchor;
display: flow;
left: 10px;
right: 10px;
position: absolute;
justify-self: anchor-center;
width: 80px;
border: 1px #000 solid;
background: lime;
}
</style>
<div class="anchor">anchor</div>
<div class="container">
<div class="target">target 1</div>
</div>