Titan Network

More Titan Projects => ParagonWiki => Topic started by: Sekoia on January 27, 2012, 02:33:58 PM

Title: New extension for CSS
Post by: Sekoia on January 27, 2012, 02:33:58 PM
I just installed a new extension on Paragon Wiki and Ouroboros Portal that allows you to embed CSS blocks within the page. Unlike inline CSS, this allows you to define style directives that apply to the whole page.

For instance, you might normally do something like this (except imagine that it has a few dozen rows):

Code: [Select]
{| class="wikitable"
|-
| style="background-color: yellow; text-align: right; width: 15em;" | Example
| 12
|-
| style="background-color: yellow; text-align: right; width: 15em;" | Sample
| 18
|}

You could now do this (again, imagine that it has a few dozen rows):

Code: [Select]
<css>
.hilite { background-color: yellow; text-align: right; width: 15em; }
</css>
{| class="wikitable"
|-
| class="hilite" | Example
| 12
|-
| class="hilite" | Sample
| 18
|}

Now imagine that you want to change the highlight color from yellow to light blue. It's much easier to change it in the second example! Not to mention that the second example is also much more readable/editable.

This also allows you to do other things you normally wouldn't be able to easily do. For instance, suppose you have two dozen tables on a page. They all have the same layout. You want their column widths to line up. You could go through and manually assign the column widths to each one, but then if you need to make changes it's a lot of work. You could make a template, but if this is the only page it'll be used on, it could be a bit excessive. Or... you could use this template to embed the relevant CSS on the page and then it's easy to maintain, without needing extra templates.

I doubt this template will get all that widely used, but hopefully it'll prove useful.
Title: Re: New extension for CSS
Post by: eabrace on January 27, 2012, 02:47:00 PM
Interesting addition.  I can see where it might come in handy from time to time.
Title: Re: New extension for CSS
Post by: Sekoia on January 27, 2012, 03:45:14 PM
As an example of it in action, it made it massively easier for me to give Enhancement Names (http://paragonwiki.com/wiki/Enhancement_Names) a cleaner style.