<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="id">
	<id>https://wiki.javasatu.com/index.php?action=history&amp;feed=atom&amp;title=Javasatu%3ATemplateStyles</id>
	<title>Javasatu:TemplateStyles - Riwayat revisi</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.javasatu.com/index.php?action=history&amp;feed=atom&amp;title=Javasatu%3ATemplateStyles"/>
	<link rel="alternate" type="text/html" href="https://wiki.javasatu.com/index.php?title=Javasatu:TemplateStyles&amp;action=history"/>
	<updated>2026-04-07T20:37:41Z</updated>
	<subtitle>Riwayat revisi halaman ini di wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.javasatu.com/index.php?title=Javasatu:TemplateStyles&amp;diff=8751&amp;oldid=prev</id>
		<title>Adminjavasatu: ←Membuat halaman berisi '{{short description|Wikimedia project guideline for TemplateStyles}} {{Subcat guideline|editing guideline||WP:TSTYLE|WP:TSTYLES}}  '''TemplateStyles''' memungkinkan halaman CSS kustom digunakan untuk menata konten tanpa administrator antarmuka untuk mengedit CSS di seluruh situs. TemplateStyles memudahkan editor untuk menata gaya template; misalnya, templat yang menggunakan CSS di seluruh situs untuk tampilan seluler atau tampilan lainnya (mis. Time...'</title>
		<link rel="alternate" type="text/html" href="https://wiki.javasatu.com/index.php?title=Javasatu:TemplateStyles&amp;diff=8751&amp;oldid=prev"/>
		<updated>2023-10-09T15:39:57Z</updated>

		<summary type="html">&lt;p&gt;←Membuat halaman berisi &amp;#039;{{short description|Wikimedia project guideline for TemplateStyles}} {{Subcat guideline|editing guideline||WP:TSTYLE|WP:TSTYLES}}  &amp;#039;&amp;#039;&amp;#039;TemplateStyles&amp;#039;&amp;#039;&amp;#039; memungkinkan halaman CSS kustom digunakan untuk menata konten tanpa &lt;a href=&quot;/index.php?title=WP:IADMIN&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:IADMIN (halaman belum tersedia)&quot;&gt;administrator antarmuka&lt;/a&gt; untuk mengedit CSS di seluruh situs. TemplateStyles memudahkan editor untuk menata gaya template; misalnya, templat yang menggunakan CSS di seluruh situs untuk tampilan seluler atau tampilan lainnya (mis. Time...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Halaman baru&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{short description|Wikimedia project guideline for TemplateStyles}}&lt;br /&gt;
{{Subcat guideline|editing guideline||WP:TSTYLE|WP:TSTYLES}}&lt;br /&gt;
&lt;br /&gt;
'''TemplateStyles''' memungkinkan halaman CSS kustom digunakan untuk menata konten tanpa [[WP:IADMIN|administrator antarmuka]] untuk mengedit CSS di seluruh situs. TemplateStyles memudahkan editor untuk menata gaya template; misalnya, templat yang menggunakan CSS di seluruh situs untuk tampilan seluler atau tampilan lainnya (mis. Timeless) saat ini berdampak negatif terhadap tampilan templat.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines ==&lt;br /&gt;
*Style harus hanya diimplementasikan hanya pada templat terkait. Ini mungkin juga berlaku untuk teks wiki terdekat yang sangat relevan di mana templat tersebut digunakan. (Misalnya, ada banyak templat tabel yang seharusnya memiliki TemplatStyles yang disediakan seluruhnya dalam templat, atau yang mungkin memberikan legenda pada tabel teks wiki.) Jika tidak, akan membingungkan jika menambahkan templat ke satu bagian halaman akan sepenuhnya atau mengubah sebagian tampilan atau gaya bagian halaman yang tidak terkait.&lt;br /&gt;
&lt;br /&gt;
* Halaman style harus dikaitkan dengan templat atau grup templat tertentu, dan diberi nama yang sesuai. Hal ini memungkinkan halaman gaya mudah diidentifikasi dan diedit. Secara umum, ini berarti halaman gaya harus merupakan subhalaman dari templat terkait, misalnya: {{mxt|Templat:{{var|templatSaya}}/styles.css}} atau {{mxt|Templat:{{var|templatSaya}}/styles-{{var|foo}}.css}}, bukan {{!mxt|Templat:styles-{{var|foo}}.css}} maupun {{!mxt|Templat:{{var|foo}}.css}}.&lt;br /&gt;
&lt;br /&gt;
* Umumnya menurut [[mediawikiwiki:Manual:Coding conventions/CSS|MediaWiki coding conventions for CSS]]. Beberapa hal spesifik:&lt;br /&gt;
** Use selectors that are highly likely to be unique to the template being used. This reduces the chance of conflicting CSS rules arising accidentally. Examples: Use {{mxt|.{{var|myTemplate}}-row}} rather than {{!mxt|.row}} or {{mxt|.{{var|myTemplate}} tr}} rather than {{!mxt|tr}}.&lt;br /&gt;
** Avoid using {{!mxt|#id}} per the conventions. HTML IDs are supposed to be unique on a page. Templates are rarely used uniquely, and those that are initially single-use-per-page are often later used in unanticipated ways. Use classes instead of IDs for styling.&lt;br /&gt;
** Avoid using {{!mxt|!important}} per the conventions, except in mobile views to override style input from the associated template. Use of &amp;lt;code&amp;gt;!important&amp;lt;/code&amp;gt; in TemplateStyles is exceptionally difficult to override because of loading order of styles (personal CSS then TemplateStyles).&lt;br /&gt;
* In templates intended to be substituted, or those likely to be substituted, use {{tl|ifsubst}} to remove the TemplateStyles tag. Example: {{tl|allcaps}}.&lt;br /&gt;
** Inline styles may be used as the &amp;quot;if substed&amp;quot; case in a substituted template. Example: {{tl|smallcaps}}.&lt;br /&gt;
* Images that do not require attribution (i.e. those in the public domain) are the only images that may be used as background images. For normal file usage, attribution is provided on the file description page, accessed by clicking the image. This is not possible if the image is being used as the background.&lt;br /&gt;
* The protection level of style pages should match that of their associated template. If a template is [[Wikipedia:High-risk templates|high-risk]], then its styles are also high-risk, and should have the same protection. If a template is not high-risk, then vandalism to cause chaos could be achieved just by editing the template itself. A higher protection level for the style page would encourage editors to add inline styles to the template, since the template would be editable but the style page would not. Any templates using CSS pages with the wrong protection level will be categorized in {{Cl|Templates using TemplateStyles with a different protection level}}.&lt;br /&gt;
* Remember to add &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/* {{pp-template}} */&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to any protected CSS pages to ensure that they display the appropriate lock icon. Protected templates using CSS pages that lack the lock icon will be categorized in {{Cl|Templates using TemplateStyles without padlocks}}.&lt;br /&gt;
Note that the [[Wikipedia:Manual of Style|Manual of Style]], including the [[Wikipedia:Manual of Style/Accessibility|Accessibility guidelines]], still applies.&lt;br /&gt;
&lt;br /&gt;
== Workflow for conversion ==&lt;br /&gt;
# In {{mxt|Template:{{var|myTemplate}}}}, identify all of the inline styles that can be moved to a separate stylesheet.&lt;br /&gt;
# Create {{mxt|Template:{{var|myTemplate}}/styles.css}} containing all the classes that will replace the inline styles. Use template-specific class names where possible.&lt;br /&gt;
# In {{mxt|Template:{{var|myTemplate}}}} (or its {{mxt|Template:{{var|myTemplate}}/sandbox}} if you want to test first), add {{tag|templatestyles|params=src=&amp;quot;{{var|myTemplate}}/styles.css&amp;quot;|single}} (you don't need to specify the Template: namespace). It's probably best at the top so that it is obvious and to avoid a [[flash of unstyled content]], but it will need to be on its own line if the template begins with wiki markup that has to start on a new line (e.g. wiki-table).&lt;br /&gt;
# Amend the template (or sandbox) to replace the inline styles with the classes you defined in {{mxt|Template:{{var|myTemplate}}/styles.css}}&lt;br /&gt;
# Do as much checking as you can. If you tested in the sandbox you can check the testcases page where it exists, but specifically check that the styles you affected render properly.&lt;br /&gt;
## Specifically, for templates meant to be used inline, check to see if there are uses inside of links. TemplateStyles templates will not work inside links ([[:phab:T200704|right now]]).&lt;br /&gt;
# If you used the sandbox, either make an edit request for the main template or do the update if you are confident of your changes.&lt;br /&gt;
# Request or amend the protection level of {{mxt|Template:{{var|myTemplate}}/styles.css}} to match that of {{mxt|Template:{{var|myTemplate}}}} as necessary.&lt;br /&gt;
# Add {{tlx|Uses TemplateStyles}} to the template's documentation to show which TemplateStyles stylesheets it uses.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Uses of TemplateStyles stylesheets are recorded just like template transclusion and Scribunto module invocation. [[Special:WhatLinksHere]] and the &amp;quot;Templates used in this preview&amp;quot; section beneath the edit form will work for them in the usual manner.&lt;br /&gt;
* To search for TemplateStyles stylesheets, you can [[Special:Search/all: contentmodel:sanitized-css|search for {{tt|contentmodel:sanitized-css}}]]. See also [[mw:Help:CirrusSearch#Contentmodel]].&lt;br /&gt;
* When {{tlx|Uses TemplateStyles}} is placed on a template's documentation, it adds the template to [[:Category:Templates using TemplateStyles]]. If the TemplateStyles stylesheet has a different protection level, the template will be tracked in [[:Category:Templates using TemplateStyles with a different protection level]] ({{PAGESINCAT:Templates using TemplateStyles with a different protection level}} page{{#ifeq:{{PAGESINCAT:Templates using TemplateStyles with a different protection level}}|1||s}}).&lt;br /&gt;
* TemplateStyles experiments can be created at [[Template:TemplateStyles sandbox]], e.g. for use in [[Module:Sandbox]] module experiments.&lt;br /&gt;
&lt;br /&gt;
== Overriding TemplateStyles ==&lt;br /&gt;
{{anchor|Override}}&lt;br /&gt;
Because of the way TemplateStyles is implemented, overriding TemplateStyles in your personal CSS requires a little more effort than normal. The rules on a specific TemplateStyles sheet are not the full CSS rules, nor can you match the selectors to override them.&lt;br /&gt;
&lt;br /&gt;
# Each selector is 'hoisted' to &amp;lt;code&amp;gt;.mw-parser-output&amp;lt;/code&amp;gt;, so to override a rule in a TemplateStyles sheet that looks like &amp;lt;code&amp;gt;.documentation {}&amp;lt;/code&amp;gt;, a naive override in your personal CSS file would need to look like &amp;lt;code&amp;gt;.mw-parser-output .documentation {}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# However, in the HTML each TemplateStyles style is {{em|always}} placed after your personal CSS file loads. Accordingly, the new rule would need to be more specific. That can come in a couple ways. The easiest is to select the HTML element also as in: &amp;lt;code&amp;gt;.mw-parser-output div.documentation {}&amp;lt;/code&amp;gt;. Another way would be to double one of the class selectors, as in &amp;lt;code&amp;gt;.mw-parser-output.mw-parser-output .documentation {}&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;.mw-parser-output .documentation.documentation {}&amp;lt;/code&amp;gt;. This latter way is a little more future-proof but looks a little weirder.&lt;br /&gt;
# Lastly, &amp;lt;code&amp;gt;!important&amp;lt;/code&amp;gt; can always override styles in your personal CSS. The usual caveats regarding &amp;lt;code&amp;gt;!important&amp;lt;/code&amp;gt; apply. Prefer one of the two options in bullet two if possible. (You must do this to override inline styles, regardless of any of the above; some templates cannot move everything to TemplateStyles per the flexibility given to template users. Implementers of templates should consider whether parameters like &amp;lt;code&amp;gt;style&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;width&amp;lt;/code&amp;gt; are actually necessary. See also [[:phab:T200632]].)&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
* [[:mw:Help:TemplateStyles/examples]]&lt;br /&gt;
** [[:mw:Template:Stylish]] ([[:mw:Template:Stylish/styles.css|CSS]])&lt;br /&gt;
** [[:mw:Template:ResponsiveAmboxExample]] ([[:mw:Template:ResponsiveAmbox/styles.css|CSS]])&lt;br /&gt;
* [[Template:Thermometer]] and [[Template:Thermometer/styles.css]] give a simple demonstration of how TemplateStyles may be mixed with inline styles (where a parameter is passed to change one or more styles)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Wikipedia:Lua]]&lt;br /&gt;
* [[MediaWiki talk:Common.css/to do]], where conversion from Common.css, Mobile.css, and skin.css to TemplateStyles is being tracked&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [[mw:Extension:TemplateStyles]]&lt;br /&gt;
* [[mw:Help:TemplateStyles]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Wikipedia template guidelines]]&lt;br /&gt;
[[Category:Wikipedia template help]]&lt;/div&gt;</summary>
		<author><name>Adminjavasatu</name></author>
	</entry>
</feed>