How?AddCSS

From OneSci
Jump to: navigation, search

This extension allows CSS stylesheets to be included in specific articles. The CSS can be another article, a file or can be rules defined directly within the parser-function.

Usage

For example, if you have a CSS article called "MyStyles.css", which are the styles intended for use with the article "MyFancyUserPage", you would add the following parser-function syntax to the latter,

{{#css:MyStyles.css}}

If on the other hand "MyStyles.css" was a file in the /wiki/skins directory, then it would be included as shown below. Note that the file must be an absolute path with a leading slash to distinguish it from an article title.

{{#css:/wiki/skins/MyStyles.css}}

Alternatively, CSS rules can be directly included within the parser-function (inline) as in the following example,

{{#css:
  body {
    background: yellow;
    font-size: 20pt;
    color: red;
  }
}}


EXAMPLE

{{#css:
    #x97z { color: red }
}}
----------------------------------------------------

<div id="x97z">

This text will be red because of the CSS style sheet.

</div>


{{#css:

   #x97z { color: red }

}}

This text will be red because of the CSS style sheet.

Personal tools