Help:Collapsing

From WikiMD's Wellness Encyclopedia

edit 

Edit WikiMD



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

tags with specific classes that are styled by CSS and controlled by JavaScript. Here is a basic example:
<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:

See Also



Contributors: Prab R. Tumpati, MD