Jump to content

User:BryanDavis/Sandbox/Templatestyles

From Wikitech

How can I use Extension:Templatestyles outside of the "Template" namespace?

Example usage

Wikitext

<templatestyles src="User:BryanDavis/Sandbox/Templatestyles/styles.css" />
[[File:Dont panic.svg|class=width200 custom-img-style-via-templatestyles]]

CSS styles

.custom-img-style-via-templatestyles { border:2px dotted green; } .width200 { width: 200px; height: auto; /* preserve aspect ratio */ }

Result

How to

  • Create style page somewhere on your wiki. This example will use path/to/style/page.css in later steps.
  • Use Special:ChangeContentModel to set the content model of that page to "Sanitized CSS"
  • Add <templatestyles src="path/to/style/page.css"/> to a content page
  • Add custom styles as needed to your style page
  • Use custom styles as needed in your content page
  • Don't Panic! :)