Einführung in die CSS-Paginierung

Die Paginierung ist die Methode, mit der das Dokument in Seiten aufgeteilt und nummeriert wird. Die Paginierung erleichtert das Auffinden einer großen Menge von Inhalten und zerlegt mehrere Einträge oder Webinhalte in verschiedene Seiten, so dass Sie den Inhalt problemlos durchblättern können. Paginierte Weblinks ermöglichen es Ihren Inhalten, von Besuchern gesurft zu werden. CSS-Paginierung ist eine recht gute Methode, um verschiedene Seiten einer Website auf der Homepage zu indizieren. Wenn Ihre Website viele Seiten enthält, müssen Sie für jede Seite eine Paginierung hinzufügen.

Arten der Paginierung in CSS

Nachfolgend sind die Arten der Paginierung in CSS aufgeführt:

  • Einfache Paginierung
  • Aktive und schwebbare Paginierung
  • Abgerundete aktive und schwebbare Tasten
  • Begrenzte Paginierung
  • Abgerundete Rand-Paginierung
  • Zentrierte Paginierung
  • Raum zwischen Paginierung
  • Paginierungsgröße

1. Einfache Paginierung

Das folgende Beispiel zeigt eine einfache Paginierung. Mit der Klasse "Paginierung" kann die Paginierung in den HTML-Seiten definiert werden.

Code:



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)

Simple Pagination
«
1
2
3
4
5
6
7
8
9
10
»



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)

Simple Pagination
«
1
2
3
4
5
6
7
8
9
10
»



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)

Simple Pagination
«
1
2
3
4
5
6
7
8
9
10
»

Speichern Sie den obigen Code in der HTML-Seite und benennen Sie ihn nach Ihrer Wahl. Öffnen Sie die Datei in einem Browser und die Ausgabe wird wie im folgenden Bild gezeigt angezeigt.

Ausgabe:

2. Aktive und schwebbare Paginierung

Die aktuelle Seite wird mit der aktiven Klasse angezeigt. Wenn die Maus darüber fährt, ändert Hover die Farbe der Seitenverknüpfung.

Code:



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Active and Hoverable Pagination
«
1
2
3
4
5
6
7
8
9
10
»



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Active and Hoverable Pagination
«
1
2
3
4
5
6
7
8
9
10
»



.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Active and Hoverable Pagination
«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

3. Abgerundete aktive und schwebbare Schaltflächen

Bei dieser Art der Paginierung kann die Randradius-Eigenschaft für abgerundete aktive und schwebbare Schaltflächen verwendet werden.

Code:



Rounded Active and Hoverable Buttons

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
border-radius:6px;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
border-radius:6px;
)

Rounded Active and Hoverable Buttons
«
1
2
3
4
5
6
7
8
9
10
»



Rounded Active and Hoverable Buttons

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
border-radius:6px;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
border-radius:6px;
)

Rounded Active and Hoverable Buttons
«
1
2
3
4
5
6
7
8
9
10
»



Rounded Active and Hoverable Buttons

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
)
.pagination a.active (
background-color:#d7bb6c;
border-radius:6px;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
border-radius:6px;
)

Rounded Active and Hoverable Buttons
«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

4. Begrenzte Paginierung

Dieser Typ kann verwendet werden, wenn Sie der Paginierung einen Rand hinzufügen möchten.

Code:



Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»



Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»



Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

5. Abgerundete Rand-Paginierung

Dieser Typ kann verwendet werden, wenn Sie der Paginierung mithilfe der Eigenschaft border-radius einen abgerundeten Rand hinzufügen möchten.

Code:



Rounded Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border-radius:6px;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Rounded Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»



Rounded Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border-radius:6px;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Rounded Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»



Rounded Bordered Pagination

.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border-radius:6px;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Rounded Bordered Pagination
«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

6. Zentrierte Paginierung

Diese Art der Paginierung kann mit Hilfe der Eigenschaft text-align zentriert angezeigt werden.

Code:



Centered Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Centered Pagination

«
1
2
3
4
5
6
7
8
9
10
»



Centered Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Centered Pagination

«
1
2
3
4
5
6
7
8
9
10
»



Centered Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Centered Pagination

«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

7. Raum zwischen Paginierung

Diese Art der Paginierung kann verwendet werden, um zwischen Seitenlinks Platz zu schaffen, anstatt sie zu gruppieren. Der Abstand kann mit Hilfe von margin property zwischen den Links angegeben werden.

Code:



Space Between Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Space Between Pagination

«
1
2
3
4
5
6
7
8
9
10
»



Space Between Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Space Between Pagination

«
1
2
3
4
5
6
7
8
9
10
»



Space Between Pagination

.center (
text-align:center;
)
.pagination a (
font-size: 18px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Space Between Pagination

«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

8. Paginierungsgröße

Diese Art der Paginierung kann verwendet werden, um die Größe der Paginierung zu ändern. Dies kann mithilfe der Eigenschaft font-size erfolgen.

Code:



Pagination Size

.center (
text-align:center;
)
.pagination a (
font-size: 22px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Pagination Size

«
1
2
3
4
5
6
7
8
9
10
»



Pagination Size

.center (
text-align:center;
)
.pagination a (
font-size: 22px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Pagination Size

«
1
2
3
4
5
6
7
8
9
10
»



Pagination Size

.center (
text-align:center;
)
.pagination a (
font-size: 22px;
float: left;
margin:0px 6px;
padding: 8px 16px;
text-decoration: none;
border:1px solid grey;
)
.pagination a.active (
background-color:#d7bb6c;
)
.pagination a:hover:not(.active) (
background-color: #d4d5d2;
)

Pagination Size

«
1
2
3
4
5
6
7
8
9
10
»

Ausgabe:

Fazit

Bisher haben wir die Rolle der Paginierung untersucht, bei der die große Menge an Inhalten in verschiedene HTML-Seiten aufgeteilt werden kann und der Benutzer problemlos mit den Informationen wechseln kann. Um den Inhalt zu paganisieren, kann die Paginierungsklasse in den HTML-Elementen verwendet werden. Daher ist die CSS-Paginierung sehr hilfreich, wenn eine große Menge des Inhalts der HTML-Seiten in einzelne Seiten unterteilt werden kann.

Empfohlene Artikel

Dies ist eine Anleitung zur CSS-Paginierung. Hier werden die verschiedenen Arten der CSS-Paginierung wie Simple, Active und Hoverable sowie die Code-Implementierung erläutert. Sie können auch unsere Artikelvorschläge durchgehen, um mehr zu erfahren -

  1. Einsatz von CSS in der Technologie
  2. Tipps und Tricks zur Verwendung von CSS-Befehlen
  3. Einführung in die Top 6 Vorteile von CSS
  4. Leitfaden für die 10 wichtigsten Fragen zu CSS-Vorstellungsgesprächen