Help:Collapsing

Collapsing is a feature 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. Similar to the Table of Contents, other parts of a wiki page can be designed to collapse.

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.



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:

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:

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

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 " ".

Note: to change these links site-wide would require editing MediaWiki:Collapsible-expand and MediaWiki:Collapsible-collapse.

Toggle button
If you notice in the example table above, the link in the second column really increases the width of the table compared to the text within it. We can fix that by having the toggle placed anywhere 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

Show/Hide table

Further Help & Feedback
de:Hilfe:Ausklappbare Elemente es:Ayuda:Colapsando fr:Aide:Déroulement ja:ヘルプ:折り畳み pl:Pomoc:Zwijanie pt:Ajuda:Collapsing ru:Справка:Сворачивание zh:Help:摺疊