264:, 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
35:
119:
The style must apply only to the associated template's output. It may also apply to highly-relevant nearby wikitext where the template is used. (For example, there are many table templates which should have
TemplateStyles which are provided entirely in templates, or which may provide a legend to a
256:
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
535:
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
106:
having to edit sitewide CSS. TemplateStyles make it more convenient for editors to style templates; for example, those templates for which the sitewide CSS for the mobile skin or another skin (e.g. Timeless) currently negatively affects the display of the template.
484:
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.
123:
Style pages should be associated with a specific template or group of templates, and named accordingly. This allows style pages to be easily identified and edited. In general, this means that a style page should be a subpage of the related template, e.g.:
201:
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
471:
as an admin and template editor. Regardless of what method is used, creating a .css page in userspace can only be done by the user in question or an interface admin, but once it is created anyone can edit
446:
265:
120:
wikitext table.) It would otherwise be confusing if adding a template to one part of a page were to completely or partially change the display or styling of an unrelated part of the page.
361:
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.
275:
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
276:
170:
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
463:
TemplateStyles pages can be created outside of the template or module namespaces by either first creating them in template namespace and moving them (perhaps at
364:
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 (
420:
592:
give a simple demonstration of how
TemplateStyles may be mixed with inline styles (where a parameter is passed to change one or more styles)
17:
348:, 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).
442:
373:
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.
288:
577:
645:
213:
in
TemplateStyles is exceptionally difficult to override because of loading order of styles (personal CSS then TemplateStyles).
164:
640:
42:
573:
344:(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
650:
558:
607:
589:
464:
453:
412:
Uses of
TemplateStyles stylesheets are recorded just like template transclusion and Scribunto module invocation.
318:
containing all the classes that will replace the inline styles. Use template-specific class names where possible.
567:
416:
and the "Templates used in this preview" section beneath the edit form will work for them in the usual manner.
261:
58:
436:
397:
620:
427:
209:
per the conventions, except in mobile views to override style input from the associated template. Use of
468:
50:
345:
284:
260:
The protection level of style pages should match that of their associated template. If a template is
445:. If the TemplateStyles stylesheet has a lower protection level, the template will be tracked in
625:
610:, where conversion from Common.css, Mobile.css, and skin.css to TemplateStyles is being tracked
413:
351:
Amend the template (or sandbox) to replace the inline styles with the classes you defined in
479:
585:
508:
placed after your personal CSS file loads. Accordingly, the new rule would need to be more
82:
563:
75:
8:
512:. That can come in a couple ways. The easiest is to select the HTML element also as in:
294:
245:
241:
Inline styles may be used as the "if substed" case in a substituted template. Example:
67:
54:
232:
222:
103:
545:
365:
402:
to the template's documentation to show which
TemplateStyles stylesheets it uses.
110:
TemplateStyles work on all types of pages, not just templates, despite the name.
218:
In templates intended to be substituted, or those likely to be substituted, use
457:
307:, identify all of the inline styles that can be moved to a separate stylesheet.
634:
602:
531:
can always override styles in your personal CSS. The usual caveats regarding
524:. This latter way is a little more future-proof but looks a little weirder.
447:
Category:Templates using
TemplateStyles with a different protection level
266:
Category:Templates using
TemplateStyles with a different protection level
614:
509:
497:, a naive override in your personal CSS file would need to look like
516:. Another way would be to double one of the class selectors, as in
493:, so to override a rule in a TemplateStyles sheet that looks like
441:
is placed on a template's documentation, it adds the template to
113:
596:
552:
99:
53:
may apply. Substantive edits to this page should reflect
277:
Category:Templates using
TemplateStyles without padlocks
475:
Moving a sanitized CSS page will not create a redirect.
518:.mw-parser-output.mw-parser-output .documentation {}
504:However, in the HTML each TemplateStyles style is
419:To search for TemplateStyles stylesheets, you can
406:
522:.mw-parser-output .documentation.documentation {}
632:
27:Wikimedia project guideline for TemplateStyles
452:TemplateStyles experiments can be created at
102:pages to be used to style content without an
228:to remove the TemplateStyles tag. Example:
49:Editors should generally follow it, though
376:Request or amend the protection level of
41:This page documents an English Knowledge
443:Category:Templates using TemplateStyles
14:
633:
514:.mw-parser-output div.documentation {}
165:MediaWiki coding conventions for CSS
29:
499:.mw-parser-output .documentation {}
24:
574:mw:Template:ResponsiveAmboxExample
57:. When in doubt, discuss first on
25:
662:
544:are actually necessary. See also
428:mw:Help:CirrusSearch#Contentmodel
336:if you want to test first), add
33:
608:MediaWiki talk:Common.css/to do
590:Template:Thermometer/styles.css
559:mw:Help:TemplateStyles/examples
465:Template:TemplateStyles sandbox
454:Template:TemplateStyles sandbox
489:Each selector is 'hoisted' to
13:
1:
646:Knowledge template guidelines
641:Knowledge editing guidelines
7:
621:mw:Extension:TemplateStyles
10:
667:
480:Overriding TemplateStyles
469:Special:ChangeContentModel
423:contentmodel:sanitized-css
65:
59:this guideline's talk page
346:flash of unstyled content
18:Knowledge:Template styles
338:<templatestyles src="
289:Accessibility guidelines
651:Knowledge template help
295:Workflow for conversion
104:interface administrator
626:mw:Help:TemplateStyles
414:Special:WhatLinksHere
273:/* {{pp-template}} */
163:Generally follow the
586:Template:Thermometer
564:mw:Template:Stylish
460:module experiments.
437:Uses TemplateStyles
398:Uses TemplateStyles
342:/styles.css" /: -->
456:, e.g. for use in
167:. Some specifics:
495:.documentation {}
491:.mw-parser-output
384:to match that of
291:, still applies.
93:
92:
43:editing guideline
16:(Redirected from
658:
543:
539:
536:parameters like
534:
530:
523:
519:
515:
500:
496:
492:
440:
424:
401:
390:
383:
358:
343:
335:
327:
317:
306:
287:, including the
274:
271:Remember to add
250:
244:
237:
231:
227:
221:
212:
208:
200:
193:
189:
181:
177:
159:
151:
146:Template:styles-
143:
131:
85:
78:
37:
36:
30:
21:
666:
665:
661:
660:
659:
657:
656:
655:
631:
630:
617:
599:
555:
541:
537:
532:
528:
521:
517:
513:
498:
494:
490:
482:
467:), or by using
434:
422:
409:
395:
389:
385:
381:
377:
356:
352:
341:
337:
333:
329:
326:
322:
315:
311:
305:
301:
297:
285:Manual of Style
272:
248:
242:
235:
229:
225:
219:
210:
206:
198:
191:
187:
183:
179:
175:
171:
157:
153:
149:
145:
141:
137:
133:
129:
125:
116:
89:
88:
81:
74:
70:
62:
34:
28:
23:
22:
15:
12:
11:
5:
664:
654:
653:
648:
643:
629:
628:
623:
616:
615:External links
613:
612:
611:
605:
598:
595:
594:
593:
583:
582:
581:
571:
554:
551:
550:
549:
525:
507:
502:
481:
478:
477:
476:
473:
461:
458:Module:Sandbox
450:
431:
417:
408:
405:
404:
403:
392:
387:
379:
374:
371:
370:
369:
359:
354:
349:
339:
331:
324:
319:
313:
308:
303:
296:
293:
283:Note that the
281:
280:
269:
258:
254:
253:
252:
216:
215:
214:
203:
195:
185:
173:
161:
155:
147:
139:
135:
127:
121:
115:
112:
96:TemplateStyles
91:
90:
87:
86:
79:
71:
66:
63:
48:
47:
38:
26:
9:
6:
4:
3:
2:
663:
652:
649:
647:
644:
642:
639:
638:
636:
627:
624:
622:
619:
618:
609:
606:
604:
603:Knowledge:Lua
601:
600:
591:
587:
584:
579:
575:
572:
569:
565:
562:
561:
560:
557:
556:
547:
526:
511:
505:
503:
488:
487:
486:
474:
470:
466:
462:
459:
455:
451:
448:
444:
438:
432:
429:
425:
418:
415:
411:
410:
399:
393:
391:as necessary.
375:
372:
367:
363:
362:
360:
350:
347:
320:
309:
299:
298:
292:
290:
286:
278:
270:
267:
263:
259:
255:
247:
240:
239:
234:
224:
217:
204:
196:
169:
168:
166:
162:
122:
118:
117:
111:
108:
105:
101:
98:allow custom
97:
84:
80:
77:
73:
72:
69:
64:
60:
56:
52:
46:
44:
39:
32:
31:
19:
546:phab:T200632
483:
282:
205:Avoid using
197:Avoid using
190:rather than
178:rather than
109:
95:
94:
40:
426:. See also
421:search for
382:/styles.css
357:/styles.css
316:/styles.css
257:background.
130:/styles.css
635:Categories
533:!important
529:!important
388:myTemplate
380:myTemplate
355:myTemplate
340:myTemplate
332:myTemplate
325:myTemplate
314:myTemplate
304:myTemplate
211:!important
207:!important
186:myTemplate
174:myTemplate
144:, but not
136:myTemplate
128:myTemplate
114:Guidelines
83:WP:TSTYLES
51:exceptions
449:(1 page).
386:Template:
378:Template:
366:right now
353:Template:
330:Template:
323:Template:
312:Template:
302:Template:
262:high-risk
246:smallcaps
154:Template:
134:Template:
126:Template:
76:WP:TSTYLE
68:Shortcuts
55:consensus
597:See also
553:Examples
527:Lastly,
510:specific
334:/sandbox
328:(or its
202:styling.
138:/styles-
310:Create
233:allcaps
223:ifsubst
506:always
542:width
538:style
433:When
588:and
540:and
407:Tips
394:Add
180:.row
176:-row
158:.css
152:nor
150:.css
142:.css
578:CSS
568:CSS
520:or
472:it.
321:In
300:In
199:#id
182:or
156:foo
148:foo
140:foo
132:or
100:CSS
637::
548:.)
439:}}
435:{{
400:}}
396:{{
368:).
249:}}
243:{{
238:.
236:}}
230:{{
226:}}
220:{{
192:tr
188:tr
580:)
576:(
570:)
566:(
501:.
430:.
279:.
268:.
251:.
194:.
184:.
172:.
160:.
61:.
45:.
20:)
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.