Help - Search - Members - Calendar
Full Version: Site specific stylesheets
Neowin Forums > Help & Discussion Center > Software Discussion & Assistance > Web Browser Discussion > Opera (Presto)
alex.
As some of you may know using a userjs opera is able to add a custom string to the opening html tag of pages to allow you to custom style webpages.

With the intoduction of the Technical Preview of Opera the Opera developers have mad it possible to do this without using a userjs.

Here's how:

QUOTE
Site-Specific Stylesheets
In case you missed the news, Opera 9.0 TP1 allows you to use permanent custom stylesheets for web sites without the need to use javascript hacks of any kind.

Overrides

First, you specify which sites need custom stylesheet, by adding this section to opera6.ini

[Overrides]
annevankesteren.nl
freebsd.org

As mentioned elsewhere, (freebsd.org) will match www.freebsd.org and freebsd.org, whilst (www.freebsd.org) will match only www.freebsd.org. Be general, unless you need to be specific.

Case 1: Removing Author Styles, Using a Custom Stylesheet

[annevankesteren.nl]
Author Display Mode|Author CSS=0
Author Display Mode|User CSS=1
User Prefs|Local CSS File=/home/moose/opera-admin/css-site/annevankesteren.css

You can cram various settings for this particular site, but for the purposes of illustration, I choose to present only application of the custom stylesheet. The first line, (Author Display Mode|Author CSS=0) tells Opera to not use the author's stylesheet. The second line tells Opera to use your own stylesheet (this line is not necessary if you have user CSS enabled in author mode). Finally, the third line points Opera to your custom stylesheet.

I have a directory with outsourced Opera settings, which are used by several separate installations I maintain. The paths are that of unix - adjust for Windows/mac as necessary.

Case 2: Keeping Author Styles, Using a Custom Stylesheet

[freebsd.org]
Author Display Mode|Author CSS=1
Author Display Mode|User CSS=1
User Prefs|Local CSS File=/home/moose/opera-admin/css-site/freebsd.css

The first line, (Author Display Mode|Author CSS=1) tells Opera to keep the author's stylesheet. The second line tells Opera to use your own stylesheet. neither the first, nor the second line is necessary if you have both author and user CSS enabled in author mode). Finally, the third line points Opera to your custom stylesheet.

Summary

Since I have both author and user CSS enabled in author mode, I need only the following additions to opera6.ini:

[Overrides]
annevankesteren.nl
freebsd.org

[annevankesteren.nl]
Author Display Mode|Author CSS=0
User Prefs|Local CSS File=/home/moose/opera-admin/css-site/annevankesteren.css
[freebsd.org]User Prefs|Local CSS File=/home/moose/opera-admin/css-site/freebsd.css

Benefits

Why use this?

1. No need to run user scripts that insert hooks for styling
2. No need to invoke scripting environment for all sites, even those which do not have any scripts, by always running user javascript
3. Easy management of site profiles
4. Support for local directories of site stylesheets
5. User js quirks and imperfections, particularly related to page load time - matter no more

<abba>Gimme, Gimme, Gimme</abba>

What else do we need to make this more of a killer feature than it already is?
1. UI — myself, I do not need it - but some of you may
2. Support for @import in user stylesheets — Opera does not yet support it, but we're working on it

enjoy and share,

M.
SOURCE

IMO this is excellent news, being able to style pages without using a userjs which doesn't load until the page gets loaded anyway is a brilliant addition.

alex.
I have found a gmail stylesheet which fixes some of the eye candy of the site, it does however make the background behind emails a grey color which I'm going to change.

There is also a small piece of css to make the rich text buttons appear in one line like they should.

[attachmentid=145463]
Pink Floyd
oh the gmail style is nice!!
thanks thumbs_up.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.