Help:Collapsing
Edit WikiMD
This help page is a how-to guide. It details processes or procedures of some aspect(s) of Wikipedia's norms and practices. It is not one of Wikipedia's policies or guidelines, and may reflect varying levels of consensus and vetting. |
Collapsing is a technique used in MediaWiki to manage the display of content on a page. It allows for sections of content to be hidden or shown at the user's discretion, which can be particularly useful for managing long articles or detailed content lists. This feature enhances the readability and navigability of pages by allowing users to minimize sections they are less interested in, thereby focusing on their primary areas of interest.
Overview
Collapsing is implemented in MediaWiki through a combination of HTML, CSS, and JavaScript. It is often used in conjunction with templates that facilitate the automatic collapsing of sections, such as infoboxes, navboxes, and long lists.
Usage
To implement collapsing in a MediaWiki page, editors typically use the Collapsible elements feature. This can be done manually by coding or more commonly, by using pre-defined templates that include collapsible functionality.
Manual Implementation
To manually create a collapsible section, editors use HTML
<div class="mw-collapsible mw-collapsed">
<div class="mw-collapsible-content">
Content to be collapsed goes here.
</div>
</div>
In this example, the class "mw-collapsed" ensures that the content starts out collapsed. If this class is omitted, the content will start out expanded.
Using Templates
Many common CSS stylesheets and JavaScript functions support collapsible functionality out of the box. Templates like {{Collapsible list}}, {{Collapsible sections}}, and {{Navbox}} are widely used across various projects to implement collapsible sections.
Customization
Editors can customize the appearance and behavior of collapsible elements by editing the site's CSS and JavaScript. This might include changing the colors, borders, or the expand/collapse icons.
Applications
Collapsing is used in various contexts across MediaWiki sites, including:
- Navigation templates (navboxes)
- Infoboxes
- Long content lists in articles
- Discussion pages to archive old discussions
See Also
Contributors: Prab R. Tumpati, MD