Παράδειγμα σελίδωσης CSS

Μάθετε πώς να δημιουργήσετε μια ανταποκρινόμενη σελίδωση χρησιμοποιώντας το CSS.

Ευκολη σελίδωση

Εάν ο ιστότοπος έχει πολλές σελίδες, μπορεί να θέλετε να προσθέσετε μια λειτουργία σελίδων σε κάθε σελίδα:

Παράδειγμα

.pagination {
  display: inline-block;
}
.pagination a {
  color: black;
  float: left;
  padding: 8px 16px;
  text-decoration: none;
}

Δοκιμάστε το Εκτέλεση

Active hoverable pagination

Using .active Class highlights the current page and uses it when the mouse is moved over them :hover Selector changes the color of each page link:

Παράδειγμα

.pagination a.active {
  background-color: #4CAF50;
  color: white;
}
.pagination a:hover:not(.active) {background-color: #ddd;}

Δοκιμάστε το Εκτέλεση

Rounded active hoverable pagination

If you need rounded "active" and "hover" buttons, please add border-radius Attribute:

Παράδειγμα

.pagination a {
  border-radius: 5px;
}
.pagination a.active {
  border-radius: 5px;
}

Δοκιμάστε το Εκτέλεση

Hoverable transition effect

Please add transition Attribute adds a transition effect to the page links, creating a transition effect when the mouse hovers over them:

Παράδειγμα

.pagination a {
  transition: background-color .3s;
}

Δοκιμάστε το Εκτέλεση

Pagination with border

Please use border Attribute adds a border to the pagination:

Παράδειγμα

.pagination a {
  border: 1px solid #ddd; /* Gray */
}

Δοκιμάστε το Εκτέλεση

Rounded border edges

Tip:Add rounded border edges to the first and last links of the pagination:

Παράδειγμα

.pagination a:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}
.pagination a:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

Δοκιμάστε το Εκτέλεση

Space between links

Tip:If you do not want to combine page links, please add margin Attribute:

Παράδειγμα

.pagination a {
  margin: 0 4px; /* Top and bottom margins are 0, can be flexibly modified */
}

Δοκιμάστε το Εκτέλεση

Pagination size

Please use font-size Attribute changes the size of the pagination:

Παράδειγμα

.pagination a {
  font-size: 22px;
}

Δοκιμάστε το Εκτέλεση

Centered pagination

To center the pagination, please use the one that has been set text-align:center The container element (such as <div>) surrounds it:

Παράδειγμα

.center {}}
  text-align: center;
}

Δοκιμάστε το Εκτέλεση

Περισσότερα Παράδειγμα

Παράδειγμα

Δοκιμάστε το Εκτέλεση

Bread Crumbs

Μια άλλη μορφή σελίδας διαφάνειας είναι η ονομαζόμενη "bread crumbs" (bread crumbs):

Παράδειγμα

ul.breadcrumb {
  padding: 8px 16px;
  list-style: none;
  background-color: #eee;
}
ul.breadcrumb li {display: inline;}
ul.breadcrumb li+li:before {
  padding: 8px;
  color: black;
  content: "/\00a0";
}

Δοκιμάστε το Εκτέλεση