Question

I'm using sample code and CSS provided by the will_paginate gem to provide a nicely formatted pagination control on my page. However, the controls won't align horizontally. Instead, they are all stacked up vertically and centered on the page. How can I get them on one horizontal line?

The sample code is from: http://mislav.github.io/will_paginate/

HTML is:

<div class="apple_pagination">
  <div class="page_info">
    <%= page_entries_info @feeds %>
  </div>
  <%= will_paginate @feeds, :container => false %>
</div>

CSS is:

.apple_pagination {
  background: #f1f1f1;
  border: 1px solid #e5e5e5;
  text-align: center;
  padding: 1em;
  cursor: default;
  li {  list-style: none;  }
}

.apple_pagination a, .apple_pagination span {
  padding: 0.2em 0.3em;
}

.apple_pagination .disabled {
  color: #aaaaaa;
}

.apple_pagination .current {
  font-style: normal;
  font-weight: bold;
  background-color: #bebebe;
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  line-height: 1.5;
  -moz-border-radius: 1em;
  -webkit-border-radius: 1em;
  border-radius: 1em;
  text-shadow: rgba(255, 255, 255, 0.8) 1px 1px 1px;
}

.apple_pagination a {
  text-decoration: none;
  color: black;
}

.apple_pagination a:hover, .apple_pagination a:focus {
  text-decoration: underline;
}
Was it helpful?

Solution

Try display buttons with float:left;

.apple_pagination a{
   float:left
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top