Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Anchor Positioning reference</title>
<style>
.container {
width: 100px;
height: 50px;
border: 1px solid gray;
margin: 10px;
position: relative;
}
.anchor {
width: 10px;
height: 10px;
top: 30px;
position: absolute;
background: blue;
}
.anchored {
width: 50px;
height: 20px;
top: 10px;
position: absolute;
background: green;
}
</style>
<div class=container>
<div class=anchor style="left: 10px"></div>
<div class=anchored style="left: 0px"></div>
</div>
<div class=container>
<div class=anchor style="left: 45px"></div>
<div class=anchored style="left: 25px"></div>
</div>
<div class=container>
<div class=anchor style="left: 80px"></div>
<div class=anchored style="left: 50px"></div>
</div>
<div class=container>
<div class=anchor style="left: 5px"></div>
<div class=anchored style="left: 10px"></div>
</div>
<div class=container>
<div class=anchor style="left: 85px"></div>
<div class=anchored style="left: 40px"></div>
</div>