Skip to content

Instantly share code, notes, and snippets.

@teebot
Created November 27, 2014 14:39
Show Gist options
  • Save teebot/26ba7d5035c3d13b6e64 to your computer and use it in GitHub Desktop.
Save teebot/26ba7d5035c3d13b6e64 to your computer and use it in GitHub Desktop.
fixed counter on scrolling
<div class="container">
<div class="inner">
<div class="element">John</div>
<div class="element">Paul</div>
<div class="element">George</div>
<div class="element">Ringo</div>
</div>
<div class="counter">4</div>
</div>
body {
font: 16px sans-serif
}
.container {
height: 200px;
width: 300px;
border: 1px solid black;
position: relative;
padding-bottom:20px;
}
.inner {
overflow: auto;
margin-bottom: 20px;
height: 100%;
}
.element {
height: 40px;
padding: 12px;
border-bottom: 1px solid gray
}
.counter {
position:absolute;
height: 20px;
width: 100%;
text-align: center;
background: #ff0;
bottom: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment