Kittymmeow (talk | contribs) No edit summary |
BaRaN6161TURK (talk | contribs) (+TR) |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{css nav}} |
{{css nav}} |
||
{{tocright}} |
{{tocright}} |
||
− | This is a guide to the most common MediaWiki CSS selectors which may be useful in [[skin customization]]. Please note that the list of |
+ | This is a guide to the most common MediaWiki CSS selectors which may be useful in [[skin customization]]. Please note that the list of selectors below is not exhaustive. Browser [https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools developer tools] can help users who wish to customize their wiki skin and can help locate any elements not explicitly mentioned in this guide. |
− | {{clear}} |
||
==Header elements== |
==Header elements== |
||
+ | {{see|Styling the VectorTabs}} |
||
− | {| class="wikitable" |
||
− | |- |
||
− | !Identifier |
||
− | !Description |
||
− | !Recommendations |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-page-base</syntaxhighlight> |
||
− | |Empty header element that influences top position of sidebar and content. |
||
− | | |
||
− | *This is one available option for a background for the header. Useful if the desired background size will be different than that of <code>#mw-head</code>. |
||
− | *Adjusting height, vertical margins, or vertical padding will adjust top position of sidebar and content. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-head-base</syntaxhighlight> |
||
− | |Empty header element that influences top position of sidebar and content. |
||
− | | |
||
− | *'''Set <code>display: none;</code> and add extra height to <code>#mw-page-base</code> to avoid inconsistent vertical positioning of sidebar and content between browsers. Important if you need pixel-perfect positioning.''' |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-head</syntaxhighlight> |
||
− | |Actual container for the page navigation bar. |
||
− | | |
||
− | *This is not in normal flow and won't affect content or sidebar position. |
||
− | *It's easiest to set this to the same height as <code>#mw-page-base</code>, but margins or positioning can be used if border, backgrounds, or other effects are desired around the entire page actions bar. |
||
− | *If using non-standard content width, you'll probably need to set a width on this to match. In some cases, this may require a combination of positioning, margins, padding, and/or width to achieve the correct effect. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#left-navigation</syntaxhighlight> |
||
− | |Links for the content and talk page. |
||
− | | |
||
− | *Position is relative to #mw-head. |
||
− | *Use <code>top</code> and <code>left</code> to adjust position. |
||
− | *<code>left</code> will usually be set to the width of the sidebar or greater, unless you choose to adjust <code>#mw-head</code>'s position or margins instead (useful for certain effects). |
||
− | *'''Absolute units like pixels are recommended here to avoid overlapping the logo/sidebar when users have nonstandard font settings. ''Relative'' units are used by default.''' |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#right-navigation</syntaxhighlight> |
||
− | |Container for page actions links and search controls. |
||
− | | |
||
− | *Adjust position using margins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs</syntaxhighlight> |
||
− | |Containers for: the content and talk page links; and the view, edit, and history links. |
||
− | | |
||
− | *Be careful when making adjustments to margins, paddings, or font sizes in these elements, as they may end up overlapping when the browser window is narrow. |
||
− | *The Vector extension adds Javascript that can move links into the hover menu when there isn't enough width, but it does not consider margins or padding. Any desired padding should be applied to <code>div.VectorTabs span</code> instead to preserve full function of the collapse script. |
||
− | *Has a background by default. You'll likely need to remove or override it. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs li</syntaxhighlight> |
||
− | |An outer container for a single page tab link. |
||
− | | |
||
− | *Has a background by default. You'll likely need to remove or override it. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs li.selected</syntaxhighlight> |
||
− | |An outer container for a selected single page tab link. |
||
− | | |
||
− | *Has a background by default. You'll likely need to remove or override it. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs li span</syntaxhighlight> |
||
− | |An inner container for a single page tab link. |
||
− | | |
||
− | *Has a background by default. You'll likely need to remove or override it. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs li span a</syntaxhighlight> |
||
− | |A page tab link. |
||
− | | |
||
− | *Has height set in relative units. This may need to be changed to absolute units depending on height of the header. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorTabs li.new span a</syntaxhighlight> |
||
− | |A page tab link for a page that doesn't exist. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorMenu</syntaxhighlight> |
||
− | |Container for the hover menu tabs in the top bar. |
||
− | | |
||
− | *If the height for the tab links has been adjusted, height here should generally be adjusted to match. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorMenu h3 span::after</syntaxhighlight> |
||
− | |Element that generates the arrow in the hover menus. |
||
− | | |
||
− | * The arrow is created using a background image, so the appearance of the arrow can be changed by using a different arrow image as the background image. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.vectorMenu div.menu</syntaxhighlight> |
||
− | |Container for the hover menu (only the part that appears when hovering over the arrow). |
||
− | | |
||
− | *If the height of the hover menu tabs have been adjusted, it may be necessary to adjust the menu's position with <code>left</code> and <code>top</code> so there is no gap between the tab and the menu. |
||
− | *If the menu is closing while the mouse cursor is still over it, you may need to increase the <code>z-index</code>. A really high value like 3000 gives you plenty of room to adjust <code>z-index</code> elsewhere if you so desire. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#p-sharing</syntaxhighlight> |
||
− | |Container for the share hover menu tab. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#p-sharing div#socialIconImages</syntaxhighlight> |
||
− | |Container for the sharing icons inside the share hover menu. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#p-sharing div#socialIconImages a</syntaxhighlight> |
||
− | |The individual sharing icons inside the share hover menu. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#p-cactions</syntaxhighlight> |
||
− | |Container for the hover menu tab with the page actions (such as delete). |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#p-cactions div.menu ul li a</syntaxhighlight> |
||
− | |A link in the hover menu. |
||
− | | |
||
− | *Spacing between the links can be adjusted with vertical padding or margins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.vectorTabs #ca-watch.icon a</syntaxhighlight> |
||
− | |The watch button. |
||
− | | |
||
− | *The appearance of the star can be changed by changing the background image of this element. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.vectorTabs #ca-unwatch.icon a</syntaxhighlight> |
||
− | |The unwatch button. |
||
− | | |
||
− | *The appearance of the star can be changed by changing the background image of this element. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#p-search</syntaxhighlight> |
||
− | |Outer container for the search box and buttons. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#p-search form</syntaxhighlight> |
||
− | |Inner container for the search box and buttons. |
||
− | | |
||
− | *If trying to adjust the vertical position of the search box and buttons, start by adjusting <code>line-height</code>. This can help improve positioning across browsers due to <code>line-height</code>'s vertical centering effect. |
||
− | *It is sometimes helpful to make <code>div.vectorTabs</code> taller, move <code>#left-navigation</code> and <code>#right-navigation</code> up by the same amount, add that amount of top margin to the actual tabs, and allow <code>#p-search</code> to be the same height as <code>div.vectorTabs</code> without any vertical margins or padding. This is helpful if you'd prefer larger font sizes to expand the search box up rather than down. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#simpleSearch #searchInput</syntaxhighlight> |
||
− | |The search box |
||
− | | |
||
− | *Useful if you want the search box to have a different appearance than other textboxes. Otherwise, it's best to leave it alone. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#simpleSearch #searchInput::placeholder</syntaxhighlight> |
||
− | |The placeholder text ("Search Gamepedia Help Wiki") inside the search box |
||
− | | |
||
− | *This selector can be used to adjust the font and color of the placeholder text. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#simpleSearch #searchButton</syntaxhighlight> |
||
− | |The magnifying glass search button |
||
− | | |
||
− | *Useful if you want the search buttons to have a different appearance than other buttons. Otherwise, it's best to leave this alone. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.suggestions</syntaxhighlight> |
||
− | |The search suggestions popup box. |
||
− | | |
||
− | * This probably does not need any styling. If you wish to change the background or borders of the search suggestions list, use <code>.mediawiki .suggestions-results</code> instead. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mediawiki .suggestions-results</syntaxhighlight> |
||
− | |The list of search suggestions. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.suggestions a.mw-searchSuggest-link, .suggestions a.mw-searchSuggest-link:hover, .suggestions a.mw-searchSuggest-link:active, .suggestions a.mw-searchSuggest-link:focus</syntaxhighlight> |
||
− | |A single search suggestion item and its various link states. |
||
− | | |
||
− | *Font color is black by default, so the color may need to be changed for dark-theme wikis. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mediawiki .suggestions-result</syntaxhighlight> |
||
− | |The inner container of each search suggestion item. |
||
− | | |
||
− | *Has a background color set by default. If you're styling search suggestions, you'll probably need to override it. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mediawiki .suggestions-result-current</syntaxhighlight> |
||
− | |The highlighted single search suggestion item. |
||
− | | |
||
− | *The highlight is applied with a background color that can be changed to change the highlighting color. |
||
− | *Has a set font color that may need to be changed if the highlight color is changed. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mediawiki .suggestions-result .highlight</syntaxhighlight> |
||
− | |The highlighted letters in the search suggestion to show where the search string matches the results' page titles. |
||
− | | |
||
− | |} |
||
− | |||
==Logo and sidebar elements== |
==Logo and sidebar elements== |
||
+ | {{See|Styling the sidebar}} |
||
− | {| class="wikitable" |
||
+ | ==Preferences page elements== |
||
− | |- |
||
+ | {{see|Styling the preferences page}} |
||
− | !Identifier |
||
+ | ==Wiki editor elements== |
||
− | !Description |
||
+ | {{see|Styling the wiki editor}} |
||
− | !Recommendations |
||
+ | {{clear}} |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel</syntaxhighlight> |
||
− | |The whole sidebar, including the logo. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#p-logo</syntaxhighlight> |
||
− | |Container for the logo link. Located at top of <code>div#mw-panel</code>. |
||
− | | |
||
− | *Set to same width and height as logo image. Reposition using <code>top</code> and <code>left</code>. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#p-logo a</syntaxhighlight> |
||
− | |The logo link, containing the logo as a background. |
||
− | | |
||
− | *Set to same width and height as logo image. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div.portal</syntaxhighlight> |
||
− | |Container for section of sidebar links. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div.portal h3</syntaxhighlight> |
||
− | |Header for each list of links in the sidebar. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.skin-hydradark #mw-panel.collapsible-nav .portal h3</syntaxhighlight> |
||
− | |The header for each list of links in the sidebar when the list is '''open''' in the collapsible sidebar mode. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.skin-hydradark #mw-panel.collapsible-nav .portal.collapsed h3</syntaxhighlight> |
||
− | |The header for each list of links in the sidebar when the list is '''closed''' in the collapsible sidebar mode. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mediawiki div#mw-panel div.portal div.body, #mw-panel.collapsible-nav .portal .body</syntaxhighlight> |
||
− | |Container for each list of links in the sidebar, not including the header. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div.portal div.body ul li, #mw-panel.collapsible-nav .portal .body ul li</syntaxhighlight> |
||
− | |The container for each individual link in the sidebar. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div.portal div.body ul li a</syntaxhighlight> |
||
− | |Each actual inner link in the sidebar. |
||
− | | |
||
− | *Use this selector to change the text color of the sidebar links. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div#p-socialProfiles</syntaxhighlight> |
||
− | |The "portal" for the social icons in the sidebar. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#mw-panel div#p-socialProfiles h3</syntaxhighlight> |
||
− | |The heading for the social portal, normally empty. |
||
− | | |
||
− | *Setting <code>display: none</code> is recommended. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.socialSidebar</syntaxhighlight> |
||
− | |A container around the social icons. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div.socialLink</syntaxhighlight> |
||
− | |The individual social links. |
||
− | | |
||
− | |} |
||
− | |||
==Content elements== |
==Content elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 392: | Line 161: | ||
==Footer elements== |
==Footer elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 413: | Line 182: | ||
==General interface elements== |
==General interface elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 477: | Line 246: | ||
| |
| |
||
*Text is black on a light green background by default. May be out of place in a dark skin. |
*Text is black on a light green background by default. May be out of place in a dark skin. |
||
− | |} |
||
− | |||
− | ==Search page elements== |
||
− | {| class="wikitable" |
||
− | |- |
||
− | !Identifier |
||
− | !Description |
||
− | !Recommendations |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mw-search-formheader</syntaxhighlight> |
||
− | |Box on search page containing the "Content pages", "Multimedia", etc. links. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.mw-search-formheader div.search-types ul li.current a</syntaxhighlight> |
||
− | |The selected search-type. |
||
− | | |
||
− | *You'll likely want to change this to match the color scheme. This will certainly need to be changed on dark skins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>fieldset#mw-searchoptions</syntaxhighlight> |
||
− | |This is the box containing the advanced search options. Click on "Advanced" to see it. |
||
− | | |
||
− | *This has a background and border set by default. The colors should generally be changed in a dark skin. |
||
− | *If you adjusted margins on <code>.mw-seatch-formheader</code>, the top margin for this should be the negative of <code>.mw-seatch-formheader</code>'s bottom margin. Note that <code>!important</code> is necessary for the top margin to take effect. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>fieldset#mw-searchoptions h4</syntaxhighlight> |
||
− | |The heading inside the advanced search options box. |
||
− | | |
||
− | *If you added any borders to <code>h4</code> elements, it often looks better to remove them here. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>fieldset#mw-searchoptions div.divider</syntaxhighlight> |
||
− | |The horizontal line inside the advanced search options box. |
||
− | | |
||
− | *It's usually best to set this to same styles as <code>hr</code>. |
||
|} |
|} |
||
==Page history elements== |
==Page history elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 528: | Line 264: | ||
| |
| |
||
*This has a border and background by default. On dark skins, these will typically need to be changed to different colors. |
*This has a border and background by default. On dark skins, these will typically need to be changed to different colors. |
||
− | |} |
||
− | |||
− | ==Diff page elements== |
||
− | {| class="wikitable" |
||
− | |- |
||
− | !Identifier |
||
− | !Description |
||
− | !Recommendations |
||
|- |
|- |
||
|<syntaxhighlight lang=css>table.diff</syntaxhighlight> |
|<syntaxhighlight lang=css>table.diff</syntaxhighlight> |
||
Line 572: | Line 300: | ||
|Unchanged lines included to provide context. |
|Unchanged lines included to provide context. |
||
| |
| |
||
+ | |} |
||
+ | |||
+ | ==Search page elements== |
||
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
||
+ | |- |
||
+ | !Selector |
||
+ | !Description |
||
+ | !Recommendations |
||
+ | |- |
||
+ | |<syntaxhighlight lang=css>.mw-search-formheader</syntaxhighlight> |
||
+ | |Box on search page containing the "Content pages", "Multimedia", etc. links. |
||
+ | | |
||
+ | |- |
||
+ | |<syntaxhighlight lang=css>.mw-search-formheader div.search-types ul li.current a</syntaxhighlight> |
||
+ | |The selected search-type. |
||
+ | | |
||
+ | *You'll likely want to change this to match the color scheme. This will certainly need to be changed on dark skins. |
||
+ | |- |
||
+ | |<syntaxhighlight lang=css>fieldset#mw-searchoptions</syntaxhighlight> |
||
+ | |This is the box containing the advanced search options. Click on "Advanced" to see it. |
||
+ | | |
||
+ | *This has a background and border set by default. The colors should generally be changed in a dark skin. |
||
+ | *If you adjusted margins on <code>.mw-seatch-formheader</code>, the top margin for this should be the negative of <code>.mw-seatch-formheader</code>'s bottom margin. Note that <code>!important</code> is necessary for the top margin to take effect. |
||
+ | |- |
||
+ | |<syntaxhighlight lang=css>fieldset#mw-searchoptions h4</syntaxhighlight> |
||
+ | |The heading inside the advanced search options box. |
||
+ | | |
||
+ | *If you added any borders to <code>h4</code> elements, it often looks better to remove them here. |
||
+ | |- |
||
+ | |<syntaxhighlight lang=css>fieldset#mw-searchoptions div.divider</syntaxhighlight> |
||
+ | |The horizontal line inside the advanced search options box. |
||
+ | | |
||
+ | *It's usually best to set this to same styles as <code>hr</code>. |
||
|} |
|} |
||
==File/image page elements== |
==File/image page elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 601: | Line 362: | ||
*Generally, you can use the same styles you use for <code>table.wikitable td</code> here. |
*Generally, you can use the same styles you use for <code>table.wikitable td</code> here. |
||
|} |
|} |
||
− | |||
− | ==Preferences page elements== |
||
− | {| class="wikitable" |
||
− | |- |
||
− | !Identifier |
||
− | !Description |
||
− | !Recommendations |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#preferences</syntaxhighlight> |
||
− | |Container for the preferences options. |
||
− | | |
||
− | *It's necessary to consider how the page looks like Javascript enabled and disabled. It's recommended that this element get no visual styles, no margin, and no padding for this reason. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#preferences fieldset</syntaxhighlight> |
||
− | |Container for a "tab page" of preferences options. |
||
− | | |
||
− | *With Javascript enabled, only one "page" of options appears at a time, and this fieldset contains it. With Javascript disabled, all "pages" are shown at once vertically arranged. |
||
− | *These will also pick up styles from <code>div#content fieldset.</code> |
||
− | *<code>border</code>, <code>margin</code>, and <code>padding</code> require <code>!important</code> to show up with Javascript enabled. |
||
− | *Having 0 horizontal margin is recommended. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#preferences fieldset legend</syntaxhighlight> |
||
− | |Title for each section of preferences options. |
||
− | | |
||
− | *When Javascript is enabled, this does not show up. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>div#preferences fieldset fieldset</syntaxhighlight> |
||
− | |Container for the inner groups of options inside a tab page. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preferences td.htmlform-tip</syntaxhighlight> |
||
− | |Small help text in the preferences options. |
||
− | | |
||
− | *By default, this is a medium gray on a white background. It should be adjusted to an appropriate medium color for the skin. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preftoc</syntaxhighlight> |
||
− | |The "tab page" links for the pages of options. |
||
− | | |
||
− | *This only appears when Javascript is enabled. |
||
− | *This has a background by default that may need to be overridden, especially on dark skins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preftoc li</syntaxhighlight> |
||
− | |Element containing a single tab link. |
||
− | | |
||
− | *This has a background by default that may need to be overridden, especially on dark skins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preftoc li a</syntaxhighlight> |
||
− | |The actual tab link. |
||
− | | |
||
− | *This has the link color set to the standard blue by default. |
||
− | *<code>#preftoc li a</code> and <code>#preftoc li a:visited</code> are generally best set to the same color. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preftoc li.selected</syntaxhighlight> |
||
− | |Element containing the currently selected tab link. |
||
− | | |
||
− | *This has a background by default that may need to be overridden, especially on dark skins. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>#preftoc li.selected a</syntaxhighlight> |
||
− | |The currently selected tab link. |
||
− | | |
||
− | *On many skins, the color may need adjustment, especially dark skins. Setting this to your context text color is a good idea. |
||
− | |} |
||
− | |||
==Various special page elements== |
==Various special page elements== |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 694: | Line 392: | ||
==AbuseFilter elements== |
==AbuseFilter elements== |
||
The AbuseFilter extension is installed by default. It doesn't add much custom CSS, but the tables on the examine/details page for an edit in the abuse log may need some work, especially on dark skins. |
The AbuseFilter extension is installed by default. It doesn't add much custom CSS, but the tables on the examine/details page for an edit in the abuse log may need some work, especially on dark skins. |
||
− | {| class="wikitable" |
+ | {| class="wikitable mw-collapsible mw-collapsed" style="width:100%;" |
|- |
|- |
||
+ | !Selector |
||
− | !Identifier |
||
!Description |
!Description |
||
!Recommendations |
!Recommendations |
||
Line 715: | Line 413: | ||
*The styles used for <code>table.wikitable td</code> are usually fine here. |
*The styles used for <code>table.wikitable td</code> are usually fine here. |
||
|} |
|} |
||
− | |||
− | ==Wikieditor elements== |
||
− | The Wikieditor extension is installed by default. It's enabled for a user when the beta features under "Editing" are checked in preferences, which they are by default. |
||
− | {| class="wikitable" |
||
− | |- |
||
− | !Identifier |
||
− | !Description |
||
− | !Recommendations |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui</syntaxhighlight> |
||
− | |Container for the edit toolbars and textarea. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui-controls</syntaxhighlight> |
||
− | |Container for the top bar containing the tabs. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui-top</syntaxhighlight> |
||
− | |Outer container for the toolbars. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui-toolbar</syntaxhighlight> |
||
− | |Inner container for the toolbars. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui-toolbar .sections .section</syntaxhighlight> |
||
− | |A sub-toolbar. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-ui-text</syntaxhighlight> |
||
− | |Container for the editing textarea. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-preview-contents</syntaxhighlight> |
||
− | |Container for the preview area. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-widget, .ui-widget-content</syntaxhighlight> |
||
− | |A wikieditor dialog box |
||
− | | |
||
− | *Font styles are applied to <code>.ui-widget</code> by default. |
||
− | *Borders and background styles are applied to <code>.ui-widget-content</code> by default. |
||
− | *Both classes generally seem to be applied to the same <code>div</code>, but it may be best to keep font styles on <code>.ui-widget</code> and background, border, and color styles on <code>.ui-widget-content</code> to be safe. |
||
− | *Only use fully or near fully-opaque backgrounds. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-widget-header</syntaxhighlight> |
||
− | |Header for a wikieditor dialog box. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikiEditor-toolbar-dialog .ui-dialog-content input[type="text"]</syntaxhighlight> |
||
− | |Textboxes in a wikieditor dialog box. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.wikieditor-toolbar-dialog-hint</syntaxhighlight> |
||
− | |Faint text inside a textbox that explains what information goes in there. |
||
− | | |
||
− | *This text should be a little faint against the background, but still easily readable. |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-button.ui-state-default</syntaxhighlight> |
||
− | |A button in a dialog box. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-button.ui-state-focus</syntaxhighlight> |
||
− | |A button in a dialog box that has keyboard focus. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-button.ui-state-hover</syntaxhighlight> |
||
− | |A button in a dialog box that the mouse cursor is hovering over. |
||
− | | |
||
− | |- |
||
− | |<syntaxhighlight lang=css>.ui-button.ui-state-active</syntaxhighlight> |
||
− | |A button in a dialog box that's being activated. |
||
− | | |
||
− | |} |
||
− | |||
− | ==Mobile view elements== |
||
− | {{see|Mobile CSS template}} |
||
− | |||
==Page-specific styling== |
==Page-specific styling== |
||
Each MediaWiki page has a unique class name assigned to the <code><nowiki><body></nowiki></code> element that is based on the current page title. In most cases this will be <code>page-</code> (or <code>rootpage-</code> if any subpages need to be targeted along with the page) followed immediately by a variation of the page title where spaces and other special characters are replaced with underscores (<code>_</code>). The exact class name may be obtained by using the browser's view-source feature on the page for which style changes are needed. |
Each MediaWiki page has a unique class name assigned to the <code><nowiki><body></nowiki></code> element that is based on the current page title. In most cases this will be <code>page-</code> (or <code>rootpage-</code> if any subpages need to be targeted along with the page) followed immediately by a variation of the page title where spaces and other special characters are replaced with underscores (<code>_</code>). The exact class name may be obtained by using the browser's view-source feature on the page for which style changes are needed. |
||
Line 804: | Line 424: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
+ | |||
+ | == See also == |
||
+ | * [[Mobile CSS]] |
||
[[Category:Advanced help]] |
[[Category:Advanced help]] |
||
+ | |||
+ | [[tr:MediaWiki CSS]] |
Latest revision as of 17:17, 8 April 2020
|
This is a guide to the most common MediaWiki CSS selectors which may be useful in skin customization. Please note that the list of selectors below is not exhaustive. Browser developer tools can help users who wish to customize their wiki skin and can help locate any elements not explicitly mentioned in this guide.
Header elements
Logo and sidebar elements
Preferences page elements
Wiki editor elements
Content elements
Selector | Description | Recommendations |
---|---|---|
#pageWrapper
|
Outer wrapper around page content and footer. |
|
div#content
|
Container for the page content. | |
div#content #firstHeading
|
The page title. | |
div#content h1, div#content h2, div#content h3, div#content h4, div#content h5, div#content h6
|
Headings in the article. |
|
.mw-editsection
|
The edit links in headings. |
|
div#toc, div.toc
|
Table of contents box. | |
div#content .toc .toctitle h2
|
Table of contents heading. |
|
.toctoggle
|
Table of contents show/hide button. |
|
hr
|
General horizontal line. |
|
ul
|
General unordered lists. |
|
table.wikitable
|
Tables in content with the wikitable class.
|
|
table.wikitable > * > tr > th, table.wikitable > tr > th
|
Table header cells in tables with the wikitable class.
|
|
table.wikitable > * > tr > td
|
Table data cells in tables with the wikitable class.
|
|
table.jquery-tablesorter th.headerSort
|
Sortable table header cells. |
|
table.jquery-tablesorter th.headerSortDown
|
Sortable table header cells. |
|
table.jquery-tablesorter th.headerSortUp
|
Sortable table header cells. |
|
table.jquery-tablesorter th.headerSortDown
|
Sortable table header cells. |
|
ul.gallery
|
Container for a standard image gallery. | |
li.gallerybox
|
Outer container for an image in a standard image gallery. Contains image and caption. | |
li.gallerybox div.thumb
|
Inner container for an image in a standard image gallery. Contains just the image. |
|
div.gallerytext
|
Caption for an image in a standard image gallery. | |
.thumb
|
Invisible outer container for a thumbnail created using the thumb argument in an image link.
|
|
.thumb.tleft
|
Invisible outer container for a thumb that's floated to the left.
|
|
.thumb.tright
|
Invisible outer container for a thumb that's floated to the right.
|
|
div.thumbinner
|
Container for a thumb around both image and caption.
|
|
html .thumbimage
|
Container for the thumb image.
|
|
.thumbcaption
|
The caption for a thumb image.
|
|
pre
|
Preformatted text. |
|
#catlinks
|
The container for the category links. |
|
Selector | Description | Recommendations |
---|---|---|
div#footer
|
The wiki page footer, including copyright text and links to About, Disclaimers, etc. | |
#footer #footer-places
|
The list of disclaimer links in the footer. | |
#footer #footer-places li a
|
Anchors within the above list in the footer. |
|
General interface elements
Selector | Description | Recommendations |
---|---|---|
input[type="text"], input[type="password"], input[type="file"], select, textarea
|
Various text and list boxes found throughout MediaWiki. | |
button, input[type="submit"], input[type="button"], input[type="reset"]
|
The various buttons found throughout MediaWiki. | |
.usermessage
|
The "You have new messages" box that appears after your user talk page is edited. | |
div.mw-warning
|
Some rare warning/error messages. | |
div.mw-warning-with-logexcerpt
|
A box that appears on deleted and protected pages when being edited that shows one or more log entries. | |
div#content fieldset
|
Boxes with controls that appear on many pages. One obvious example is the one on of Special:RecentChanges that contains link to adjust what entries are shown. |
|
div#content fieldset legend
|
The title for a fieldset box. | |
.error
|
Red text displayed on some kind of error. |
|
.errorbox
|
Text in a red box displayed on some kind of error. |
|
.warning
|
Orange text displayed to give some kind of warning. |
|
.warningbox
|
Text in a orange box displayed on some kind of error. |
|
.success
|
Green text displayed after some action is successful. |
|
.successbox
|
Text in a green box displayed after a successful action, for example, after saving preferences. |
|
Page history elements
Selector | Description | Recommendations |
---|---|---|
#pagehistory li
|
A line in the page history list. |
|
#pagehistory li.selected
|
One of the selected lines in the page history list. |
|
table.diff
|
Container for the diff results and the headers. | |
td.diff-otitle
|
The header for the old revision. | |
td.diff-ntitle
|
The header for the new revision. | |
diff-lineno
|
The line numbers above each change. | |
td.diff-addedline
|
A line that was added to the page. | |
td.diff-addedline .diffchange
|
Changed text inside a additive change line. | |
td.diff-deletedline
|
A line that was removed from the page. | |
td.diff-deletedline .diffchange
|
Changed text inside a removal change line. | |
td.diff-context
|
Unchanged lines included to provide context. |
Search page elements
Selector | Description | Recommendations |
---|---|---|
.mw-search-formheader
|
Box on search page containing the "Content pages", "Multimedia", etc. links. | |
.mw-search-formheader div.search-types ul li.current a
|
The selected search-type. |
|
fieldset#mw-searchoptions
|
This is the box containing the advanced search options. Click on "Advanced" to see it. |
|
fieldset#mw-searchoptions h4
|
The heading inside the advanced search options box. |
|
fieldset#mw-searchoptions div.divider
|
The horizontal line inside the advanced search options box. |
|
File/image page elements
Selector | Description | Recommendations |
---|---|---|
ul#filetoc
|
Top bar of links on file pages. |
|
table.mw_metadata
|
The metadata table found at the bottom of file pages. |
|
table.mw_metadata th
|
The header (left) cells in the metadata table found at the bottom of file pages. |
|
table.mw_metadata td
|
The value (right) cells in the metadata table found at the bottom of file pages. |
|
Various special page elements
Selector | Description | Recommendations |
---|---|---|
.TablePager
|
A table type seen on special pages like Special:AllMessages. |
|
.TablePager th
|
Header cells for a table type seen on special pages like Special:AllMessages. |
|
.TablePager td
|
Regular cells for a table type seen on special pages like Special:AllMessages. |
|
.TablePager tr:hover td
|
Regular cells for a table type seen on special pages like Special:AllMessages when the cursor hovers over the row. |
|
AbuseFilter elements
The AbuseFilter extension is installed by default. It doesn't add much custom CSS, but the tables on the examine/details page for an edit in the abuse log may need some work, especially on dark skins.
Selector | Description | Recommendations |
---|---|---|
table.mw-abuselog-details
|
Table seen on examine/detail pages that show abuse filter variables. |
|
table.mw-abuselog-details tr th
|
Header cells for the table seen on examine/detail pages. |
|
table.mw-abuselog-details tr td
|
Regular cells for the table seen on examine/detail pages. |
|
Page-specific styling
Each MediaWiki page has a unique class name assigned to the <body>
element that is based on the current page title. In most cases this will be page-
(or rootpage-
if any subpages need to be targeted along with the page) followed immediately by a variation of the page title where spaces and other special characters are replaced with underscores (_
). The exact class name may be obtained by using the browser's view-source feature on the page for which style changes are needed.
Here is an example of one of the most common use cases for this feature, hiding the first header on a page (which contains the page name itself):
.page-MediaWiki_CSS h1:first-child
{
display: none;
}