Jump to content

Руководство:Интерфейс/ID и классы

From mediawiki.org
This page is a translated version of the page Manual:Interface/IDs and classes and the translation is 41% complete.

This is a list of IDs and classes provided by MediaWiki core or a bundled extension/skin. Это обычно используется разработчиками расширений и гаджетов. When in doubt, consider checking with Codesearch and Global Search to empirically understand usage. For a more extended collection of historically grown list of IDs and classes, visit Wikipedia's Catalogue of CSS classes.

Main selectors

Selector Описание Компонент или владелец
.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).
.mw-first-heading Заголовок страницы. 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. 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.
Внимание Внимание: 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, Вектор, устаревшая (2010), Современная
.page- Each page has a class on the body with the name of the page encoded after a page- prefix.
#pagehistory List of revisions when viewing 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).

Содержимое

Selector Skin(s) Описание Доступность
.noprint MediaWiki core class available for action=print in most skins since at least MediaWiki 1.14.
.nomobile
.noexcerpt Used by Расширение: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 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 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 .
.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


Устаревшее

Selector Описание Skin(s)
.ltr (устарело) When the user language is left-to-right (LTR). Before that, when the content language was LTR. See also .rtl.
.rtl (устарело) When the user language is right-to-left (RTL). Before that, when the content language was RTL. See also .ltr.
#bodyContent (устарело) Use #mw-content-text instead. Or better, use the more specific #mw-content-text .mw-parser-output if applicable. All skins (except the obsolete Современная and Кёльнский синий)
#firstHeading (устарело) Use .mw-first-heading instead. All skins
.firstHeading (устарело) Use .mw-first-heading instead. All skins
.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 (устарело) Used by MediaWiki as the default container on some system messages (like the diff box).