Skip to content

Instantly share code, notes, and snippets.

@robspangler
Last active December 16, 2015 21:50
Show Gist options
  • Save robspangler/5502975 to your computer and use it in GitHub Desktop.
Save robspangler/5502975 to your computer and use it in GitHub Desktop.
Center a floating list navigation / pagination Sample HTML: <div id="pagination" class="centered-list"> <ul class="page-numbers clearfix"> <li><a class="prev" href="#prev">Prev</a></li> <li><a href="#1">1</a></li> <li><a href="#2">2</a></li> <li><a class="next" href="#next">Next</a></li> </ul> </div>
/*Centered List Items*/
.centered-list { float: left; width: 100%; overflow: hidden; position: relative; }
.centered-list ul { clear: left; float: left; position: relative; left: 50%; text-align: center; }
.centered-list ul li { float: left; position: relative; right: 50%; list-style: none; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment