Author Topic: New extension for CSS  (Read 1985 times)

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
New extension for CSS
« 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.

eabrace

  • Titan Moderator
  • Elite Boss
  • *****
  • Posts: 4,292
Re: New extension for CSS
« Reply #1 on: January 27, 2012, 02:47:00 PM »
Interesting addition.  I can see where it might come in handy from time to time.
Titan Twitter broadcasting at 5.000 mWh and growing.
Titan Facebook

Paragon Wiki admin
I was once being interviewed by Barbara Walters...In between two of the segments she asked me..."But what would you do if the doctor gave you only six months to live?" I said, "Type faster." - Isaac Asimov

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
Re: New extension for CSS
« Reply #2 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 a cleaner style.