You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

User:BryanDavis/Sandbox/Templatestyles

From Wikitech-static
Jump to navigation Jump to search

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

Dont panic.svg

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! :)