Fire Emblem Heroes Wiki
mNo edit summary
mNo edit summary
 
Line 5: Line 5:
 
*Using this widget incurs additional network traffic for each invocation, so trying to use it to save space may not have the intended effect you want, unless there are very many very long duplicate style attributes on a page.
 
*Using this widget incurs additional network traffic for each invocation, so trying to use it to save space may not have the intended effect you want, unless there are very many very long duplicate style attributes on a page.
 
*This widget also relies on the widgets extension, and is not natively part of MediaWiki so code or templates using this has poor compatibility and reusability with other wikis.
 
*This widget also relies on the widgets extension, and is not natively part of MediaWiki so code or templates using this has poor compatibility and reusability with other wikis.
*Inline styling doesn't work without JavaScript.
+
*The inline styling method of this widget doesn't work without JavaScript.
 
===Load external stylesheet===
 
===Load external stylesheet===
 
<pre>{{#widget:Style|page=<!-- wiki page name here -->}}</pre>
 
<pre>{{#widget:Style|page=<!-- wiki page name here -->}}</pre>

Latest revision as of 00:21, 6 October 2021

Usage[]

Adds CSS to wiki pages.

If your CSS can already be done without this widget, you are most likely better off using native MediaWiki inline style attributes because:

  • Using this widget incurs additional network traffic for each invocation, so trying to use it to save space may not have the intended effect you want, unless there are very many very long duplicate style attributes on a page.
  • This widget also relies on the widgets extension, and is not natively part of MediaWiki so code or templates using this has poor compatibility and reusability with other wikis.
  • The inline styling method of this widget doesn't work without JavaScript.

Load external stylesheet[]

{{#widget:Style|page=<!-- wiki page name here -->}}

This widget loads CSS from a wiki page via the HTML <link> tag.

The media and title parameters correspond to the <link> tag media and title attributes. Do not specify them if not needed.

Inline styling[]

{{#widget:Style|style=<!-- CSS here -->|media=|title=}}

This widget allows adding CSS via the HTML <style> tag.

The media and title parameters correspond to the <style> tag media and title attributes. Do not specify them if not needed.

Limitations[]

Inline styling will not work with JavaScript disabled. Appending a <style> attribute in the document body is invalid HTML, so JavaScript had to be used to append the tag to the document head.

The url() notation is disallowed. This is an intentional design choice to prevent the CSS from performing any network requests. Allowing this would create a potential privacy or security risk in that anyone with editing rights can monitor requests from this wiki to sites they control. Unfortunately, urls to this wiki are also blocked because of the simple implementation; url( is simply stripped from input passed to the widget to prevent its use. This part can change in the future.