Help:Collapsing

Collapsing is a feature that allows you to collapse (or hide) any HTML element.

There are times when a page can contain many related elements which makes it very long; using a collapsing feature enables editors to shorten the page, and allow readers to expand areas of interest to them. Most frequently this feature is used on long tables of data and large navigation templates.

To make an element collapsible, simply add the class " " to it.

Collapsing a table
By adding " " as the class, a table can be collapsed to save page space.

This results in:

Collapsing text
It is possible to collapse text in an article, effectively shortening the page, and allowing the reader to decide if they want to read the rest of the information. For example:

This text is collapsible.

This results in:

This text is collapsible.

Initial state
To set the initial state as collapsed add " " along with " ", such as seen in the following table:

This results in:

Selecting collapsible content
You can also specify which part is the collapsible content by using " ".

This text is not collapsible; but the next is collapsible and hidden by default: This text should be hidden by default. This text should be visible as well.

This results in:

This text is not collapsible; but the next is collapsible and hidden by default: This text should be hidden by default. This text should be visible as well.

Custom wording
Don't like 'Expand'/'Collapse' for the links? No problem! Change them using " " and " ".

This results in:

For a more compact toggle button, any text symbol may be used.

This results in:

Toggle button
In the first example of the previous section you may notice that the "Show spoilers" link in the second column significantly increases the width of the table. We can also fix that by moving the toggle to somewhere else on the page.

To do that, we have to assign an ID to the element. This ID must be prefixed with " " and followed by a unique key phrase for that element. Using our table above, we can add the ID " ".

That takes care of the table itself. Next, we have to add a button/link/text element with the class " " (note this is a class and not an ID like above).

Show/Hide table

This results in: Show/Hide table

Default toggle link
Input:

Output:

This is text is collapsible.

Custom Label
Input:

Output:

 This text is not hidden This text is all hidden

And is only shown

When it is uncollapsed.

Remote toggle
Input:

Output:

Toggle all Spoiler

Troll div in middle

Spoiler 1

¡HI! I am a spoiler Spoiler 2 ¡HI! I am a spoiler

Change text for other
Input:

Output:

Click here to toggle the element

Clicking will toggle it too!

Removing Brackets From Toggle
The following style rule may be added to the wiki's stylesheet to hide the brackets in the default or custom label toggle links:

Further help and feedback
de:Hilfe:Ausklappbare Elemente es:Ayuda:Contrayendo fr:Aide:Déroulement it:Aiuto:Collassabile ja:ヘルプ:折り畳み pl:Pomoc:Zwijanie pt:Ajuda:Collapsing ru:Справка:Сворачивание tr:Yardım:Daraltma uk:Довідка:Таблиці/що згортаються zh:Help:摺疊