Manual:Interface/IDs and classes

This is a list of IDs and classes provided by MediaWiki core or a bundled extension/skin. This are commonly used by extensions and gadget developers alike. When in doubt, consider checking with Codesearch and Global Search to emperically understand usage. For a more extended collection of historically grown list of IDs and classes, visit Wikipedia's Catalogue of CSS classes.

Main selectorsEdit

Selector Description Component or owner
.client-nojs Set for the entire HTML document. This indicates the browser has not successfully loaded our Grade A JavaScript layer (yet). For example, if the device is too old, or if the browser blocked JS, or if the user disabled it. This is automatically switched to .client-js. at run-time. ResourceLoader
.client-js Set for the entire HTML document. Indicates the browser has or will successfully load our Grade A JavaScript layer. This is automatically switched from .client-nojs. ResourceLoader
.comment Set on text that is a comment (also known as edit summary or log reason), which appear in places such as page history, logs, and recent changes. MediaWiki core
.diff Set on the element containing the difference comparison between revisions and the action links for those revisions. MediaWiki core
.mw-editsection Set on the parent element containing the edit section link in section headings when viewing content. Added in MW 1.22 (change 49364).
.firstHeading The page title. All skins
.mediawiki Set for the entire HTML document. This indicates the page was served through a MediaWiki skin. Commonly used to decide whether a style should not (or should only) apply to action=render and other external rendering contexts, e.g. in TemplateStyles or site styles. MediaWiki core
.mw-body-content Holds the content of the wiki page, or interface of the page action or special page. All skins
.mw-parser-output See phab:T37247, phab:T164792, gerrit:352711 and (not merged yet) gerrit:352835. MediaWiki core
.mw-content-ltr Added on the same div as #mw-content-text, except on special pages and file pages, or when not viewing the page (e.g. history) or if the page doesn't exist. More info: directionality support. Added in MW 1.18.
  Warning: Do not use this to get the content! (e.g. in JavaScript)
.mw-content-rtl See .mw-content-ltr. Added in MW 1.18.
#mw-content-text Holds everything between the page title and contentSub on the one hand, and ArticleFeedback and categories on the other hand. Present on each page view (includes history view, non-existing pages, print view, ...). Known issue: May contain unrelated elements (bug 35247). Added in MW 1.19 (r111647).
#p-logo, #p-personal, #p-views, etc identifiers for "Portlets" the skin may arrange in its navigation or sidebar. Useful for e.g. addPortletLink() MonoBook, Vector legacy (2010), Modern
#pagehistory List of revisions when viewing action=history
.sitedir-ltr When the wiki content language direction is left-to-right. Added in MW 1.18 (r91518).
.sitedir-rtl When the wiki content language direction is right-to-left. Added in MW 1.18 (r91518).

ContentEdit

Selector Skin(s) Description Availability
.noprint MediaWiki core class available for action=print in most skins since at least MediaWiki 1.14.
.nomobile
.noexcerpt Used by Extension:TextExtracts to force it to be removed from consideration from text extracts.
.notpageimage Used by Extension:PageImages to exclude images from the algorithm that selects the image used to represent the page.
.licensetpl A series of licensetpl*, fileinfotpl*, creator and other classes. See commons:Commons:Machine-readable data. See Extension:CommonsMetadata
.metadata See Help:Extension:Media Viewer#How can I disable Media Viewer for unrelated images? and Reading/Multimedia/Media Viewer/Template compatibility#Marking up article templates as ignored.
.noviewer See Help:Extension:Media Viewer#How can I disable Media Viewer for unrelated images?
.noresize MinervaNeue Used by MobileFrontend and Minerva to apply responsive sizing. As this can break some images and elements with absolute positioning (for overlays for instance), you can wrap images in an element with the class noresize to opt out from responsive sizing.
.navigation-not-searchable See Help:CirrusSearch#Exclude content from the search index.
.searchaux See Help:CirrusSearch#Exclude content from the search index.
.tmbox, .ambox, #coordinates, .navbox, .vertical-navbox, .topicon MinervaNeue Undocumented, with MobileFrontend they assume the special meaning of being "secondary content". See Mobile Gateway/Mobile homepage formatting, discussion, resources/skins.minerva.content.styles/hacks.less.
.infobox MobileFrontend and the mobile apps assume this is an infobox and will move it to after the lead of the article when they see fit. As well as applying dedicated styling for this often crucial element of Wikipedia articles.
.mw-collapsible, mw-collapsed, mw-collapsible-content Manual:Collapsible elements can collapse elements that are decorated with this class.
.wikitable Use this class on tables to create a styled table
.sortable, .unsortable Use on tables to load Javascript to make the table sortable .

DeprecatedEdit

Selector Description Skin(s)
.ltr (deprecated) When the user language is left-to-right (LTR). Before that, when the content language was LTR. See also .rtl.
.rtl (deprecated) When the user language is right-to-left (RTL). Before that, when the content language was RTL. See also .ltr.
#bodyContent (deprecated) Use .mw-body-content instead. Or better, use the more specific #mw-content-text if applicable. MonoBook, Vector legacy (2010)
#firstHeading (deprecated) Use .firstHeading instead. MonoBook, Vector legacy (2010)
.editsection Set on the parent element containing the edit section link in section headings when viewing content. Replaced in MW 1.22 with .mw-editsection in change 49364.
.warningbox, .errorbox, .successbox (deprecated) Used by MediaWiki as the default container on some system messages (like the diff box).