Manual:Gränssnitt/ID:n och klasser

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. Dessa används ofta av tillägg och finessutvecklare. When in doubt, consider checking with Codesearch and Global Search to empirically understand usage. För en mer djupgående samling historiskt framväxt lista över ID:n och klasser, gå till engelskspråkiga Wikipedias Catalogue of CSS classes.

Huvudväljare

Väljare Beskrivning Komponent eller ägare
.client-nojs Set for the entire HTML document. This indicates the browser has not successfully loaded our Grade A JavaScript layer (yet). Till exempel, om enheten är för gammal, eller om webbläsaren blockerat JS, eller om användaren inaktiverat det. Detta växlar automatiskt till .client-js. på körtid. ResourceLoader
.client-js Set for the entire HTML document. Indicates the browser has or will successfully load our Grade A JavaScript layer. Detta växlar automatiskt från .client-nojs. ResourceLoader
.comment Satt på text som är en kommentar (också känd som redigeringssammanfattning eller loggorsak), som dyker upp på exempelvis sidhistorik, loggar och senaste ändringar. MediaWiki core
.diff Satt på elementet som innehåller skillnadsjämförelsen mellan sidversioner och åtgärdslänkar för dessa sidversioner. 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 Sidtiteln. Added in MW 1.38 (for versions before, use .firstHeading). 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 Innehåller wikisidans innehåll, eller sidåtgärdens gränssnitt eller specialsida. 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.
  Varning: 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 äldre (2010), Modern
.page- Each page has a class on the body with the name of the page encoded after a page- prefix.
#pagehistory Lista över sidversioner när action=history visas
.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).

Innehåll

Väljare Utseende(n) Beskrivning Tillgänglighet
.noprint MediaWiki core class available for action=print in most skins since at least MediaWiki 1.14.
.nomobile
.noexcerpt Används av Extension:TextExtracts för att tvinga den att inte övervägas ur textextraheringar.
.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 .
.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


Avvecklade

Väljare Beskrivning Utseende(n)
.ltr (avvecklad) When the user language is left-to-right (LTR). Before that, when the content language was LTR. See also .rtl.
.rtl (avvecklad) When the user language is right-to-left (RTL). Before that, when the content language was RTL. See also .ltr.
#bodyContent (avvecklad) Use #mw-content-text instead. Or better, use the more specific #mw-content-text .mw-parser-output if applicable. All skins (except the obsolete Modern and Cologne blå)
#firstHeading (avvecklad) Use .mw-first-heading instead. All skins
.firstHeading (avvecklad) Use .mw-first-heading instead. All skins
.editsection Satt på föräldraelementet som innehåller länken "redigera avsnitt" i avsnittsrubriken när man visar innehåll. Replaced in MW 1.22 with .mw-editsection in change 49364.
.warningbox, .errorbox, .successbox (avvecklad) Used by MediaWiki as the default container on some system messages (like the diff box).