Skip to content

Instantly share code, notes, and snippets.

@maxhoffmann
Created May 9, 2014 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxhoffmann/fcc2a72a85b56955fbbc to your computer and use it in GitHub Desktop.
Save maxhoffmann/fcc2a72a85b56955fbbc to your computer and use it in GitHub Desktop.
.scrollable {
overflow: auto;
}
.scrollableWrapper {
position: relative;
}
.scrollableWrapper:before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
background: red;
height: 50px;
}
.scrollableWrapper:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: red;
height: 50px;
}
.element {
height: 200px;
}
.container ul {
margin: 0;
padding: 0;
list-style: none;
}
.container li {
height: 50px;
background: 10px;
border-bottom: 1px solid gray;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="scrollableWrapper">
<div class="element scrollable">
<div class="container">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment