Manuel:Interface/ID et classes

This page is a translated version of the page Manual:Interface/IDs and classes and the translation is 100% complete.

This is a list of IDs and classes provided by MediaWiki core or a bundled extension/skin. Ils sont couramment utilisés par les développeurs d'extensions et de gadgets. When in doubt, consider checking with Codesearch and Global Search to empirically understand usage. Pour une collection plus étendue de listes d'ID et de classes développées historiquement, visitez le catalogue des classes CSS de Wikipedia.

Sélecteurs principaux

Sélecteur Description Composant ou propriétaire
.client-nojs Set for the entire HTML document. This indicates the browser has not successfully loaded our Grade A JavaScript layer (yet). Par exemple, si l'appareil est trop vieux, ou si le navigateur a bloqué JS, ou si l'utilisateur l'a désactivé. Cette option est automatiquement remplacée par .client-js. au moment de l'exécution. ResourceLoader
.client-js Set for the entire HTML document. Indicates the browser has or will successfully load our Grade A JavaScript layer. Le passage de 1 à 1 est automatique. ResourceLoader
.comment Définir sur le texte qui est un commentaire (également connu sous le nom de résumé d'édition ou de raison de journal), qui apparaissent dans des endroits tels que l'historique de la page, les journaux et les modifications récentes. MediaWiki core
.diff Défini sur l'élément contenant la comparaison des différences entre les révisions et les liens d'action pour ces révisions. 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).
.mw-first-heading Le titre de la page 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 Contient le contenu de la page wiki, ou l'interface de la page d'action ou de la page spéciale. All skins
.mw-parser-output See phab:T37247, phab:T164792, gerrit:352711. MediaWiki core
.mw-content-ltr Added on the same div as #mw-content-text .mw-parser-output, except when there is no such element (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.
  Avertissement : 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 (ancienne version 2010), Moderne
.page- Each page has a class on the body with the name of the page encoded after a page- prefix.
#pagehistory Liste des révisions lors de l'affichage de action=history
.pcs-theme-default, .pcs-theme-dark, .pcs-theme-sepia, .pcs-theme-black Used on the body element by the mobile app and page content service to select different color themes of the content.
.skin-skinname The skin used is declared on the body, with the skin selector. This selector is skin- postfixed by the name of the skin. Use skin-vector-2022 for new vector, skin-vector applies to both legacy and 2022. All skins.
.skin--responsive This class is added to the body when the responsive user preference option is on. Added in MW 1.37. See phab:T258290. MediaWiki core, 1.37 and above.
.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).

Contenu

Sélecteur Habillage(s) Description Disponibilité
.noprint MediaWiki core class available for action=print in most skins since at least MediaWiki 1.14.
.nomobile
.noexcerpt Utilisé par Extension:TextExtracts pour le forcer à être retiré de la considération des extraits de texte.
.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 All skins The noresize class is used to identify large tables and images (eg. panoramas) to optimize how they should be displayed on screens with limited width. This is important for displaying content correctly on tablet devices and Vector 2022 in "standard" width mode - typically tables bigger than 1000px.

When utilized, tables will become horizontally scrollable across all device platforms. Where horizontal scrolling is not needed (when you are handling this behaviour yourself), you should wrap the table in a div with any other class. Note using the noresize class is important when using 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. It may not be compatible with sticky headers.

.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 Manuel:Eléments repliables 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 .
.notheme iOS and Android app Used to opt out content from the dark, black and sepia theming, which can be applied by the iOS and Android application which in turn makes use of the Page Content Service


Obsolète

Sélecteur Description Habillage(s)
.ltr (obsolète) When the user language is left-to-right (LTR). Before that, when the content language was LTR. See also .rtl.
.rtl (obsolète) When the user language is right-to-left (RTL). Before that, when the content language was RTL. See also .ltr.
#bodyContent (obsolète) Use #mw-content-text instead. Or better, use the more specific #mw-content-text .mw-parser-output if applicable. All skins (except the obsolete Moderne and Bleu de Cologne)
#firstHeading (obsolète) Use .mw-first-heading instead. All skins
.firstHeading (obsolète) Use .mw-first-heading instead. All skins
.editsection Défini sur l'élément parent contenant le lien de modification de la section dans les en-têtes de section lors de l'affichage du contenu. Replaced in MW 1.22 with .mw-editsection in change 49364.
.warningbox, .errorbox, .successbox (obsolète) Used by MediaWiki as the default container on some system messages (like the diff box).