Manual:Displaying page sections as cards: Difference between revisions

No edit summary
No edit summary
Tag: 2017 source edit
Line 1: Line 1:
{{Featurepage|featured=true|featuredesc=Seitenabschnitte als Karten (Spalten) formatieren|featurestart=03/21/2022}}Sections of a wiki page can be displayed as  "cards" with just a little bit of effort.  
{{Featurepage|featured=true|featuredesc=SeitenSectione als Karten (Spalten) formatieren|featurestart=03/21/2022}}Sections of a wiki page can be displayed as  "cards" with just a little bit of effort.  


== What are cards? ==
== What are cards? ==
Karten sind Kombinationen von zusammenhängenden Spalten, die sich durch ein bestimmtes Format auszeichnen. Jede Wikiseite kann solche Karten beinhalten.<gallery widths="480" heights="250">
Cards are combinations of contiguous page sections that share the same column layout. Each wiki page can contain such cards.
Datei:Handbuch:karten-before.png|alt=Wikiseite ohne Karten|Wikiseite ohne Karten
<gallery widths="480" heights="250">
Datei:Handbuch:karten-after.png|alt=Wikiseite mit Karten|Wikiseite mit Karten
File:Manual:karten-before.png|alt=Wikiseite ohne Karten|Wikiseite ohne Karten
File:Manual:karten-after.png|alt=Wikiseite mit Karten|Wikiseite mit Karten
</gallery>
</gallery>


== Create card styles ==
== Create card styles ==
Bevor Abschnitte als Karten formatiert werden können, muss ein Benutzer mit Admin-Rechten folgende Information zur Seite MediaWiki:Common.css hinzufügen und speichern:<syntaxhighlight lang="css">
Before sections can be formatted as cards, a user with admin rights must add and save the following information to the page ''MediaWiki:Common.css'':
<syntaxhighlight lang="css">
/* Styles for section cards */
/* Styles for section cards */
.sectionflex {display: flex; flex-wrap: wrap; justify-content:space-between;}
.sectionflex {display: flex; flex-wrap: wrap; justify-content:space-between;}
Line 23: Line 25:


== Create cards ==
== Create cards ==
Um Abschnitte als Karten zu formatieren:
To format sections as cards:


# '''Legen''' Sie eine Seite '''an''', die verschiedene Abschnitte beinhaltet. Abschnitte sind durch Überschriften gekennzeichnet.
# '''Create''' a page that contains different sections. Sections are marked by headings.
# '''Öffnen''' Sie die Seite im Quelltextbearbeitungsmodus.
# '''Öpen''' the page in source editing mode.
# '''Fügen''' Sie den Anfang für den Kartencontainer <code><nowiki><div class="sectionflex col2 background"></nowiki></code> überhalb der gewünschten ersten Karte (d.h. über der ersten gewünschten Überschrift) '''ein'''. Eine Überschrift beginnt und endet mit zwei Ist-gleich-Zeichen.:<syntaxhighlight lang="text">
# '''Add''' the start of a card container as <code><nowiki><div class="sectionflex col2 background"></nowiki></code> above the first section you want to include in the card display (i.e., above the first heading of that section). A heading starts with two equal (=) signs:<syntaxhighlight lang="text">
<div class="sectionflex col2 background">
<div class="sectionflex col2 background">
==Introduction==
==Introduction==
With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.
With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.
</syntaxhighlight>
</syntaxhighlight>
# '''Umschließen''' Sie nun alle Abschnitte, die Sie in diesem Container als Karte anzeigen wollen mit einem Start <code><nowiki><div></nowiki></code> und einem End <code><nowiki></div></nowiki>:</code><syntaxhighlight lang="text">
# '''Wrap''' all sections that you want to include in this card layout in a starting <code><nowiki><div></nowiki></code> and an end <code><nowiki></div></nowiki> tag:</code><syntaxhighlight lang="text">
<div class="sectionflex col2 background">
<div class="sectionflex col2 background">
<div>
<div>
Line 43: Line 45:
</div>
</div>
</syntaxhighlight>
</syntaxhighlight>
# '''Schließen''' Sie den sectionflex-Container selbst mit einem End <code><nowiki></div></nowiki></code>, um das Kartenlayout zu beenden:<syntaxhighlight lang="text">
# '''Close''' the sectionflex container itself with an end <code><nowiki></div></nowiki></code> tag:
<div class="sectionflex col2 background"> <! --- Start des Kartenlayouts-->
<syntaxhighlight lang="text">
<div> <! --- Start einer Karte -->
<div class="sectionflex col2 background"> <! --- Start card layout-->
<div> <! --- Start card -->
==Introduction==
==Introduction==
With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.(...)
With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.(...)
</div> <! --- Ende einer Karte -->
</div> <! --- End card -->
<div> <! --- Start einer Karte -->
<div> <! --- Start card -->
==Topography==
==Topography==
Regensburg is situated on the northernmost part of the Danube river at the geological crossroads of four distinct landscapes (...)
Regensburg is situated on the northernmost part of the Danube river at the geological crossroads of four distinct landscapes (...)
</div> <! --- Ende einer Karte -->
</div> <! --- End card -->
</div>  <! --- Ende des Kartenlayouts-->
</div>  <! --- End card layout -->
</syntaxhighlight>Die beiden Abschnitte sollten nun so aussehen:[[Datei:Handbuch:karten-after.png|alternativtext=Zwei aufeinanderfolgende Abschnitte im Kartenlayout|zentriert|mini|750x750px|Zwei aufeinanderfolgende Abschnitte im Kartenlayout: <code><nowiki><div class="sectionflex col2 background"></nowiki></code>]]
</syntaxhighlight>
The two sections should now be displayed as cards:
[[File:Manual:karten-after.png|alt=Two sections in the card layout|center|thumb|750x750px|ZTwo sections in the card layout: <code><nowiki><div class="sectionflex col2 background"></nowiki></code>]]


== Available card formats ==
== Available card formats ==
Wahlweise können Sie so 1-spaltige ("col1"),  2-spaltige ("col2") oder 3-spaltige ("col3") Karten mit grauem Hintergrund ("background") oder grauem Rahmen ("frame") erstellen. Zum Beispiel:
You can choose between 1-column ("col1"),  2-column ("col2") or 3-column ("col3") cards with grey background ("background") or grey frame ("frame"). For example:


[[Datei:Handbuch:karten-col3-frame.png|alternativtext=3-spaltig mit Rahmen|zentriert|mini|750x750px|3-spaltig mit Rahmen:  <code><nowiki><div class="sectionflex col3 frame"></nowiki></code>]]
[[File:Manual:karten-col3-frame.png|alt=3-column layout with frame|center|thumb|750x750px|3 columns with frame:  <code><nowiki><div class="sectionflex col3 frame"></nowiki></code>]]


== Combination of cards ==
== Combination of cards ==
Es ist möglich unterschiedliche Kartenformate auf einer Seite zu kombinieren:<syntaxhighlight lang="css">
It is possible to combine different card layouts on one wiki page:
<syntaxhighlight lang="css">
<div class="sectionflex col2 frame">
<div class="sectionflex col2 frame">
<div>
<div>
==Abschnitt 1==
==Section 1==
Inhalt Abschnitt 1
Content section 1
</div>
</div>
<div>
<div>
==Abschnitt 2==
==Section 2==
Inhalt Abschnitt 1
Content section 1
</div>
</div>
</div>
</div>
Line 76: Line 82:
<div class="sectionflex col3 background">
<div class="sectionflex col3 background">
<div>
<div>
==Abschnitt 3==
==Section 3==
Inhalt Abschnitt 3
Content section 3
</div>
</div>
<div>
<div>
==Abschnitt 4==
==Section 4==
Inhalt Abschnitt 4
Content section 4
</div>
</div>
<div>
<div>
==Abschnitt 5==
==Section 5==
Inhalt Abschnitt 5
Content section 5
</div>
</div>
</div>
</div>

Revision as of 17:46, 21 March 2022

Sections of a wiki page can be displayed as  "cards" with just a little bit of effort. 

What are cards?

Cards are combinations of contiguous page sections that share the same column layout. Each wiki page can contain such cards.

Create card styles

Before sections can be formatted as cards, a user with admin rights must add and save the following information to the page MediaWiki:Common.css:

/* Styles for section cards */
.sectionflex {display: flex; flex-wrap: wrap; justify-content:space-between;}
.sectionflex.col1 > div {flex-basis:100%; padding:10px 20px 20px 20px; margin:10px 0;}
.sectionflex.col2 > div {flex-basis:49%; padding:10px 20px 20px 20px; margin:10px 0;}
.sectionflex.col3 > div {flex-basis:32%; padding:10px 20px 20px 20px; margin:10px 0;}
.sectionflex > div h2 {margin:0 0 1em 0}
.sectionflex.frame > div {border: 1px solid #e7e7e7}
.sectionflex.background> div {background: #f1f3f9}
.sectionflex .ve-ce-branchNode-slug {display:none}
@media (max-width: 767px) {.sectionflex.col2 > div, .sectionflex.col3 > div {flex-basis:100%; margin-top:2em}}

Create cards

To format sections as cards:

  1. Create a page that contains different sections. Sections are marked by headings.
  2. Öpen the page in source editing mode.
  3. Add the start of a card container as <div class="sectionflex col2 background"> above the first section you want to include in the card display (i.e., above the first heading of that section). A heading starts with two equal (=) signs:
    <div class="sectionflex col2 background">
    ==Introduction==
    With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.
    
  4. Wrap all sections that you want to include in this card layout in a starting <div> and an end </div> tag:
    <div class="sectionflex col2 background">
    <div>
    ==Introduction==
    With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.(...)
    </div>
    <div>
    ==Topography==
    Regensburg is situated on the northernmost part of the Danube river at the geological crossroads of four distinct landscapes (...)
    </div>
    
  5. Close the sectionflex container itself with an end </div> tag:
<div class="sectionflex col2 background"> <! --- Start card layout-->
<div> <! --- Start card -->
==Introduction==
With more than 165,000 inhabitants, Regensburg is the fourth-largest city in the State of Bavaria after Munich, Nuremberg and Augsburg.(...)
</div> <! --- End card -->
<div> <! --- Start card -->
==Topography==
Regensburg is situated on the northernmost part of the Danube river at the geological crossroads of four distinct landscapes (...)
</div> <! --- End card -->
</div>  <! --- End card layout -->

The two sections should now be displayed as cards:

Two sections in the card layout
ZTwo sections in the card layout: <div class="sectionflex col2 background">

Available card formats

You can choose between 1-column ("col1"), 2-column ("col2") or 3-column ("col3") cards with grey background ("background") or grey frame ("frame"). For example:

3-column layout with frame
3 columns with frame: <div class="sectionflex col3 frame">

Combination of cards

It is possible to combine different card layouts on one wiki page:

<div class="sectionflex col2 frame">
<div>
==Section 1==
Content section 1
</div>
<div>
==Section 2==
Content section 1
</div>
</div>

<div class="sectionflex col3 background">
<div>
==Section 3==
Content section 3
</div>
<div>
==Section 4==
Content section 4
</div>
<div>
==Section 5==
Content section 5
</div>
</div>




To submit feedback about this documentation, visit our community forum.

No categories assignedEdit

Discussions