Anchor point stacking with absolute
Small case study for a design we implemented.
by Simon Harte
HTML
<div class="wrapper">
<div class="top">
<div class="bottom">
<ul>
<li><span>1</span></li>
<li><span>2</span></li>
<li><span>3</span></li>
</ul>
</div>
</div>
</div>
CSS
.wrapper {
margin-top: 200px;
height: 200px;
width: 300px;
background: beige;
position: relative;
}
.top {
position: absolute;
top: 0;
right: 0;
}
.bottom {
position: absolute;
bottom: 0;
right: 0;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
width: 50px;
padding-bottom: 100%;
position: relative;
}
li + li {
margin-top: 10px;
}
span {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: red;
color: white;
}