corner Document Styles: [BBL] A+ A- A corner
 

Customize The Entire Web, Stylishly

Is this document for you and your browser?

Stylish

"Stylish is a Firefox, Thunderbird, Flock, SeaMonkey, Mozilla Suite, and Songbird extension that allows easy management of user styles."

Is Stylish Installed?

It doesn't appear to be, but JavaScript must also be enabled, and you need to follow these instructions:

Firefox

When Stylish is installed, follow these steps to enable Stylish userstyle installs from www.honestlyillustrated.com:

screenshot
Access your about:config page, and type "stylish" in the Filter box.
Right-Click the line: extensions.stylish.install.allowedDomains
Select, "Modify".
screenshot
Keep the value already there, obviously. Add a space, for separation, and add this site's domain after it.
Do not include "www." or any sub-domain.
Click, "Ok".
K-Meleon, Mozilla et. al.
screenshot
K-Meleon, is Mozilla, so also has userContent.css.
You can write userstyles in most Mozilla-based browsers, if you go find out what types of CSS the browser understands.

Frequently Asked Questions Top of this page.

For information about this document, look in:

These are answers to questions often asked about userstyling with Stylish.

Could not find your answer here?: Top of this page.

This document does not cover everything, yet, asking isn't a quicker route to an answer. This document has been written as people asked questions. You can ask questions in the Userstyles.org Forum, of course, but don't be surprised (or offended) if you are linked back to this document.

Don't look for answers. Read the document.

Can I use wildcards in @-moz-document?: Top of this page.

No, you can not use wildcards to do something like this:
@-moz-document url("http://honestlyillustrated.com/userstyles/stylishguide/*.html")
I don't like it either. I wish we could.
The closest you can get is by using:
@-moz-document url-prefix("http://honestlyillustrated.com/userstyles/stylishguide/")
@-moz-document url-prefix("http://honestlyillustrated.com/userstyles/")

Make my style change all pages?: Top of this page.

That's called a "global style".

  1. Begin with Click:"Stylish Icon" > Click:"Write Style" > Click:"Blank Style".
  2. In "Add Style" window, Click:"Insert" > Click:"HTML Namespace". Because I assume you're asking about website global styles.
  3. Write some style rules for whatever HTML tag you want.

If you write something like this:

body { background-color: black; }

Click the "!important" button, so it becomes this:

body { background-color: black !important; }

Don't use @-moz-document for global styling.

Replace an image with a local image?: Top of this page.

Read: Local Resources (files) in Firefox's Paths.
Choose the method, chrome://, file:///, or resource://, which makes the most sense to you, and works best for your style's goal.
File paths written as those URI, (as opposed to http://), are ways for Firefox to access files on your disk drive(s).

Style this thing on that page?: Top of this page.

Install:
DOM Inspector
Inspect Context
Web Developer Toolbar
With Web Developer Toolbar: Top of this page.

These images are an example of using Web Developer Toolbar and Stylish, together:

screenshot
Use "CSS" -> "View Style Information", to activate a tool with a cross-hair cursor, and red border box, which indicates the HTML tag element you are hovering over.
screenshot
The toolbar has changed to CSS information mode, which shows a "bread crumb trail" through all of the tags which the hovered tag is a "descendent" of.
screenshot
That was enough information to write the example userstyle.
screenshot
When that isn't enough information, turn off "View Style Information".
Highlight some text or an image, in the area you are trying to change.
That is, Left-Click, hold it, drag across the text, release left-click. Right-Click (context menu), "View Selection Source".
screenshot
Firefox will show you this.
screenshot
Highlight some text in the target container tag, and also some text outside of it, like this.
screenshot
Usually, you will be given the entire page source, but again, the highlighted part is selected there, too.
With DOM Inspector, Inspect Context, and Web Developer Toolbar: Top of this page.

These images are an example of using Web Developer Toolbar, DOM Inspector, Inspect Context, and Stylish, together:

screenshot
Use "CSS" -> "View Style Information", to activate a tool with a cross-hair cursor, and red border box, which indicates the HTML tag element you are hovering over.
screenshot
Take advantage of this to hover the correct page element.
Right-Click.
Chose "Inspect".
screenshot
DOM Inspector has been opened, with the page element (tag) you were hovering already navigated to and selected.
Now, you can copy Stylish's selector suggestion by Right-Clicking the DOMi line.
screenshot
I have pasted the selector into Stlyish.
Then, I trimmed the selector down to only the most important part of it.
If you used the entire selector Stylish gave you, the page you are styling will be more likely to break your style, by slightly changing only one part of what you have selected. Also, your style will be huge and slow.
screenshot
Now, I have finished the selector, and given it the properties I wanted it to have.
For the ratings stars, there were 3 total images. Those same images are used on other pages, too, so I wrote selectors which can catch them all.
Then, I would move these finished CSS Rules into a @-moz-document domain("userstyles.org")

Select one URL and exclude another?: Top of this page.

Not with CSS.
Currently, @-moz-document does not allow complex expressions, such as you would need to exclude a URL that falls in the domain you selected to style.
Greasemonkey is the cure.
I'm working on a script, Greasy Black, which, amongst other things, lets you define domains and URLs in which to add a class name to those pages, and features the often requested domain and URL exclusion not found in @-moz-document.
An example of the script in action, can be seen by pairing it with this userstyle: greasy black - google 2008 ( ALL except GMail ).
Configure the script by adding lines like these:
/* A list of common class names to reuse.
*/
var class_list = new Array();

class_list['default'] = 'greasy-black';

class_list['apacheError'] = 'apacheError';
class_list['google'] = 'bigBroother';
class_list['daytime'] = 'day';
class_list['another'] = 'anotherclassnamehere';
// Domains or URLs that you want to include.
do_class['google.com'] = class_list['google'];
do_class['customize.likethis.etc'] = 'yourclassnamehere';
do_class['anotherone.etc'] = class_list['another'];
// Domains or URLs that you want to exclude.
// No wildcards here.
// For URLs, this behaves just like @-moz-document url-prefix
dont_class['mail.google.com'] = true;
dont_class['http://maps.google.'] = true;
dont_class['butnotthis.anotherone.etc'] = true;
dont_class['http://anotherone.etc/and/not/this/either/'] = true;

What HTML tag does that select?: Top of this page.

td[bgcolor="#000080"]{background-color:green!important}
Selects: <td bgcolor="000080">
Selectoracle says:
Selects any td element with a bgcolor attribute that equals #000080.
Read: Selectors.
Learn: HTML.

Prerequisite Knowledge Top of this page.

Cascading Style Sheets:
CSS Specification: The nuts and bolts of how CSS is supposed to work.
CSS Tutorial: W3C's official guide to their specification.
Cheat Sheets: Has PNG images for visual reference of CSS basics.
Document Object Model:
DOM: This is a program/memory structure into which a page is loaded by a browser. It's what allows CSS and JavaScript to easily influence the page, dynamically.
Hyper-Text Markup Language:
HTML: Still the most common markup found in The Web (I think).
XHTML: Probably the easier markup for CSS designers to deal with, when they have the choice. That's only true because XHTML forces HTML to be written as HTML is supposed to be written. Well written HTML, of any flavor, is easy to style.
Programming:
JavaScript: You won't need to know it, just to write a UserStyle. You DO need to know, however, that UserStyles are effected by JavaScript code present on the styled page(s). JavaScript is used to modify page content, which could include CSS.
Stylish:
Stylish: Is the subject of this tutorial.
XML User-Interface Language:
XUL: Don't let them lie to you. There isn't only XUL, but it does happen to be the language that the Mozilla byte-code interprets, so that's what Firefox and its extensions are written with.

Suggested Tools Top of this page.

  Mozilla Extensions which are integrated with Stylish:
These extensions, when installed alongside Stylish, get special functions from Stylish.
DOM Inspector: Is included with FireFox. Windows users have to opt-in, within a "Custom" install, and some Linux distributions have separated it from the FireFox package. If you didn't install it the first time through, just install again, in the same directory, and choose "Custom" this time. Stylish adds a "Copy Selector" menu to DOMi's treeview context menu.
It's All Text: Provides an "Edit", or "It's All Text!", button next to multiline text input areas. Configurable to open a change-monitored text file in system default or custom text editor. You'll find such a button in the Stylish editor.
Rainbow Picker: A typical color picker, offering a color spectrum and palette.
Mozilla Extensions:
Chrome List: Browse the current profile chrome directories.
Edit Config Files: A convenient toolbar menu with a list of the important configuration files, and the option for those files to be opened in your favorite text editor.
FireBug: Includes DOM node inspection, with many more relevant debugging features.
Inspect Context: Adds an "Inspect" item to all context menus (right-click), which invokes DOM Inspector for the node you have right-clicked.
Inspector Widget: This one provides a toolbar button which, when clicked, allows the next click to invoke DOM Inspector for the clicked GUI element. This is useful, since Inspect Context, doesn't put the menuitem into all context menus.
Quick Restart or Toolbar Buttons: Either of these, or one like them, include a "Restart" button and/or hot-key. These are "easy buttons" for applying changes to FireFox preferences.
Session Manager: Better than 2.0.0.x default session memory. Recover properly from crashes, and return to the entire set of previous open (tabbed) pages, after restarts.
Web Developer Toolbar and XML Developer Toolbar: Offer many useful perspectives from which to investigate a page. Isolate the parts you're studying.
Text Editors:
jEdit: Free/Open Source.
kDiff: Free/Open Source. Not an editor. This is used to observe differences in multiple file versions.
Metapad: Free/Open Source, Windows.
Nexus TextView: Free/Open Source, Windows.
NotePad++: Free/Open Source.
NotesPad: Free, Windows.
Programmer's Notepad: Free/Open Source. They also have a version of it written in Python.
Ultra-Edit 32: Commercial, Windows.
Vim: Free/Open Source.
Text Editor Features You Need:
Comparison of Text Editors: Wikipedia entry.
CTAGs: Code browsing framework.
Web-Applications & Services:
Selectoracle: Given some CSS code, this translates the selectors into verbose English or Spanish sentences.

Mozilla's CSS Defaults Top of this page.

You'll learn how Firefox draws chrome and pages on the screen, by studying the prerequisite knowledge. A key clue, though, is how markup languages are given their default behaviors. Some of the behavior is hard-coded into the software (I think), since it probably makes sense to do that to some things, and seems like it would be necessary for their box-model to work. There is, however, a set of CSS files to define behaviors.

Default *.css are in your Firefox program directory:
These are Firefox resources.
These links do nothing when clicked. This explains why. Instead, Right-Click, "Copy Link Location", and paste the URI to your location (URL) textbox.
The most important files are probably:
forms.css: Styles that draw form widgets.
html.css: What else?
quirk.css: Fall-back styles for attempting to properly render erroneous or non-standard syntax.
ua.css: User Agent styles. Until I read otherwise, I think this is the default meta-style. Along with its rules, it imports "html.css", "xul.css", and "quirk.css", in that order. You also find "parsererror" and "sourcetext" selectors, for XML error pages, here.
xul.css: XUL dialog and document window widget styles.
Eric Meyer has written two pages, relevant to this:
Really Undoing html.css
Fractionally Restoring html.css

CSS Basics Top of this page.

CSS Rule Diagram

Example Style Top of this page.

@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("userstyles.org"),
               url("http://blog.userstyles.org"),
               url-prefix("http://userstyles.org/forum")
{
  body
  {
    background: #999999 !important;
    color: #000000 !important;
  }
}

Whitespace, you may notice, is not consistent in most anyone's CSS or HTML code. The software which reads markup usually pays attention only to visible character syntax. In theory, this is so that human writers of markup can use whitespace as their eyes demand, for legibility. Here, we've done just that, so that you can see which parts of the visible syntax are important, in context of how the browser will read it.

It is the { brackets }, ( parenthesis ), "double-quotes", and semi-colons;, which are telling the parser where each kind of functional statements are relevant; where their content begins and ends. Just as the semi-colon in that sentence altered the relevance of the statement which followed it. The CSS semi-colon, though, ends a property value declaration, the way a period ends an English sentence.

Namespace Jan 03 2008Posted by: Alex K. @ groups.google.com mozilla.support.firefox

@namespace url(http://www.w3.org/1999/xhtml);

According to what I've read, namespaces are part of the CSS3 spec: http://www.w3.org/TR/css3-namespace/

...

Look at chrome://global/content/xul.css, and notice:

...

At the top of the file, there are three namespace declarations:
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
@namespace xbl url("http://www.mozilla.org/xbl"); /* namespace for XBL elements */

You'll notice that in the XUL declaration, there is no 'xul' prefix between the '@namespace' and the 'url()'. That is because they are identifying it as the default. Basically, its saying that anything without a namespace prefix will use this namespace. The other two declarations define the prefix that will be used for those namespaces, immediately after the '@namespace', 'html' and 'xbl'.

...

That's a summary of: Simple Selectors

@-moz-document

@-moz-document domain("userstyles.org"),
               url("http://blog.userstyles.org"),
               url-prefix("http://userstyles.org/forum")

This states that the following rules apply to documents on that domain.

@-moz-document is a Mozilla-specific at-rule that restricts the style rules contained within it based on the URL of the document. It is designed primarily for user style sheets.

Lets you select domains or subdomains, such as, "google.com", "maps.google.com", and/or:

url("http://www.google.com/"), and/or:

url-prefix("http://www.google.com/search")

In CSS 2, there is no way to do wildcard or negation on these.

There can be multiple entries in the list, comma separated.

{
  • Opens the document style.

Selectors Top of this page.

  body
For IDs, use #someid, for Classes, use .someclass.
[class="someid"]or [id="someid"] Will be useful to remember, when someone (Google GMail) has used RFC Invalid ID and Class naming.

Example tag: <input id="before-screenshot-none" name="before screenshot" type="radio" value=""></input>
See it in DOM, in this screenshot, on the rightside.
You could select such a node (tag) like this:

input[id="before-screenshot-none"] Has to be an input with an id of before-screenshot-none.
[id="before-screenshot-none"] Any with that id.
#before-screenshot-none Same as [id="before-screenshot-none"] in meaning, but if they appeared together, applied to the same page (even if in separate files), CSS considers #before-screenshot-none to be more important, so uses it. That's called precedence.
[id] Anything with an id.
input Any inputs.
[id$="screenshot-none"] Any id that ends with screenshot-none.
[id$="before"] Any id that starts with before.
[id*="screenshot"] Any id that contains screenshot.
#before-screenshot-none[type] Needs that id, and any type attribute.

On the left side of the screenshot, a bit below the input, there's a tr with a th and td. The th and td are direct descentdants (child nodes) of the tr.
You can use tr > td to select any td with a tr direct parent, or tr span to select any span children with a tr parent.
tr span label That would select any labels that have a tr then span parent.
tr>span > label This wouldnt select the label in the screenshot since i didnt include the td.
th + td To select adjacent siblings.

To use adjacent siblings correctly, you must pay attention to the nesting order of the tags. In CSS, adjacent means "directly above or below this tag, at the same nesting depth." So, table rows are not adjacent to their children table cells. Table rows, <tr>, are adjacent to other table rows.

Then there's pseudo-classes, such as in: th:first-child+td which selects a td if there's a th just above it that is the first child node of its parent (In the screenshot, "#text" is not a node/tag, it is showing that there is text content in the node, relative to where DOMi is printing the "#text" place-holder).


:before
:after
:only-child If you notice on a webpage html is the parent for body and head. :only-child wont select either of them since body and head are siblings of each other.
:first-line
:first-letter
:empty Doesnt have any children or content.
:hover Mouseover.
:active Clicked, then released (or dragged).
:focus Accepting input, the keyboard cursor is inside it.
:-moz-any-link Any links (-moz prefix is often used in Mozilla Extentions of CSS).
:link An anchor tag, which has an "href", Hyper-Reference, property.
:visited Visited links.
* Everything.

[id]:not(input) Anything with an id but not inputs. This is a special pseudo-class, called negation. :not(.someclass) :not([type="blah"]) :not(:first-child)
a[href^="javascript:"]:not([href^="javascript:if\(confirm\(\"You"]):after The \ back-slashes escape the characters after them, because they are part of the content of the selector, instead of part of the selector syntax, CSS needs to be told that in this way. As is usual with back-slash escaping, two of them, "\\", will mean one actual \.

Selector Specificity Jan 07 2008 Posted By: Valacar @ userstyles.org

I've noticed quite a few styles that are basically duplicates of one style with minor changes to them, like changing colors or the font. Instead of making a copy of the style and modifying it, you can make an addon style by taking advantage of CSS specificity. What this means is that for all selectors that you want to modify, you simply make the selector more specific.

Let's say the style you're modifying looks like this:

@-moz-document url("") {

  body {
    background-color: #000 !important;
    color: #fff !important;
  }

  .message {
    color: red !important;
    font-style: italic !important;
  }

  .anotherMessage { color: #6699cc !important; }
  // tons more code after this

}
 

Here, I give you an <iframe>, containing a page which uses Valacar's CSS example, quoted above. Use it to test his suggestions upon. I've modified his examples to reflect how they are used on the following <iframe>:

Hint:

@-moz-document url("") {
 [style*=".gif"],
 .dot1,
 .message9
  { display: none !important; }
}

Now, for an addon style, let's say the only thing we want to do is modify .message. We want to change it from red text to yellow. Here's what my new addon style will look like:

@-moz-document url("") {

  body .message { color: yellow !important; }

}

What I did was prefix "body " to the original selector. By doing this, you're being more specific about things, and the result is that you override the original selector. Notice though, in the addon style we only told it to override the color, but if you look at the original style, it specifies that the font-style is italic. When the original style and the addon style are both enabled, the text will be yellow AND it will still be italic. With that said, we can just as easily add to it; for example, you can change it to normal yellow text using the Verdana font:

@-moz-document url("") {

  body .message {
    color: yellow !important;
    font-style: normal !important;
    font-family: Verdana, sans-serif !important
  }

}

So, for pretty much every selector that you want to override, you can just prefix it with "body " (that's the word "body" followed by a space character). This isn't the only way to increase specificity, but I would say it's the easiest way, especially if you don't care to look at the original HTML code.

Hmm, but what if you want to modify the body element? We can't use "body body", because the body element will never be a descendant of another body element. Instead, we'll prefix it with "html " since body is always a descendant of the html element:

  html body { background-color: #ccc !important; }

And what about overriding the html element?

<html> has no ancestors RE: Posted By: whatrevolution

"html:root" seems to work. "* html" won't work, because :root does.

It's also important to know that while you're writing such a style, to overlay another one, with the original style loaded (obviously!), stylish's load order can lie to you about wether or not you've actually gotten the selector specificity right. Stylish.rdf reads from top to bottom, so new styles have natural priority over older ones.

Just for fun, here are a few more ways to increase specificity:

.message
div.message // assuming the original html code was <div class="message">
body .message
body div.message
html body .message
html body div.message

All of those are likely to select the same thing, but each one is being more specific. You can also use tag (element) property selectors to be more specific.

html[xmlns] body div.message
html:not([xmlns]) body div.message
html body:not([link]) div.message
html body:not([imaginary_tag_property]) div.message // this would select any body node, by never negating the imaginary property

In any User Style, you must match or exceed the specificity of the original CSS. That applies to the entire set of selectors and properties. Existing properties must be overwritten or negated, if you don't want them involved in the result, and the selector ancestry syntax ( spaces, > or + ) must usually match or beat the original.

An example of specificity in this page's style.css

While writing Mozilla's CSS Defaults, I found that the <dt> font was ugly in that context, but appropriate outside of the <div> containers. I realized that the <div> containers all have a class="" property, while <html>, <body>, and the meta-container (wrapping the entire page, in case it's embedded somewhere, later) need no class. My first attempt to take advantage of that looked like this:

/* Default Fonts */

 :not([class]) dl > dt,
 h1, h2, h3, h4 ,h5, h6
  {
    font-family: tahoma, sans-serif ;
  }

I was confused for a moment, because that did not work. It DOES look like it would work, doesn't it? Luckily, I had just included this section today, so I quickly realized why it didn't work.

 :not([class]) > dl > dt,

I needed the >, because the <dt> inside the Mozilla's CSS Defaults <div> was also an ancestor of multiple classless nodes. This is the difference between descendants and children, and is also well illustrated here.

  {

Properties Top of this page.

    background: #999999 !important;
    color: #000000 !important;
  • A basic rule to change the background color to grey and the text color to black.
  • "#999999" is a hexedecimal color value from the 216 Color Cross Browser Palette, yet, any hexedecimal color value is technically valid.
  • "!important", forces this property to be chosen instead of a previous one. CSS DOM remembers the most recently loaded property of a selector, or the most explicitly relevant one based on the amount of selectors given. "!important" overrides non-!important ones, and is key in userstyling. Stylish editor has an "!important" button, which will add that text to the end of all properties.

background Can contain (combine) all of the separate "background-" properties. This is called a shorthand property.

background-image Place an image behind the content of a node/tag. background-image: url("http://website.com/picture.png");

You can use Data URI to embed the image data in the CSS file. Before you do that, write out the rest of the background: or background-image: property, like this:

background-image:url();

Place the keyboard cursor between the parenthesis, then at the top-left of the Stylish editor, click: Insert, Data URI. Select the file, and you're done. The editor, when this tutorial was written, will scroll to the top of the textarea when you do this, which is why you should write the rest of the property first.

background-position Used to postion the image, such as center it: background-position:center center;
background-repeat no-repeat, so it doesn't tile, or repeat-x, or repeat-y, to only tile it on that axis.
background:red url("chrome://branding/content/about.png") center center no-repeat;
Go to: chrome://
background-color Change background colour of an element (node/tag).
color Change text colour.

CSS color values  

Where a color value is needed, you can use words: black lightblue, or any other CSS Color Name.

RGB: rgb(123,213,43)
  • Each of the three decimal values can be in the range of 0 to 255
  • The RGB decimal range is modeled on the human visible light spectrum. So, 0 is black, and 255 is white.
  • They represent the amount of Red, Green, Blue, to be added (as when mixing paints), and the number's distance from 127 determines how much white and black to mix in, providing a sum which is the color. So, rgb(127,127,127) has nearly equal amounts of everything in it, and is the middle shade of grey.
Hexedecimal: #FFFFFF (white)
  • Hexedecimal colors are RGB colors, in hexedecimal representation, because hexedecimal is shorter than decimal, for long numbers.
  • The pattern is still RGB, so #FFFFFF = rgb(255,255,255)
  • 0 is still 0, although where the value is padded to meet a length requirement, common in programming, it is 00.
  • 255 is FF.
  • 254 is FE. Notice, in relation to FF, all I did was subtract 1. In hex, F - 1 = E.
  • F, in decimal, is 15. 0 1 2 3 4 5 6 7 8 9 A B C D E F
  • In #FD, F is decimal 240, D is decimal 13, and FD as a total is 240 + 13 = 253
  • #0D = 13, #1D = 29, #1F = 31.
  • So, in #1F that is: (16 x 1) + 15 = 31
  • In #FD that is: (16 x 15) + 13 = 253
  • CSS lets you shorten hexedecimals like #FFFFFF, to #FFF
  • #999999 can be #999
  • #CCCCCC can be #CCC
  • #CCFF00 can be #CF0
  • This does not mean that #FF = #F, or #99 = #9. What's actually happening is the CSS specification states that web designers are lazy, and as such, they should not be required to press a key twice, when once would suffice. The CSS parser, instead, must spend a processor cycle or three to find out that #FFF is #FFFFFF is rgb(255,255,255) is white.
  • MoreCrayons has good web color information and tools.
text-align Align text to: left right center
vertical-align top middle bottom
text-decoration none underline overline line-through blink
direction Set the direction that the text is meant to be read in: ltr rtl

position Tell an element of a webpage to behave as: static relative absolute fixed
top The value will be the distance from this edge of the parent node, or display window, depending on the "position" in effect for the selected element.
bottom
left
right

Positioning confuses everyone

Make something fixed to the bottom of the page: position:fixed;bottom:0;
Fixed means "fixed on screen". Use absolute if you dont want it to stay there while you scroll. Absolute doesn't always place it at the top of the page, it actually means "absolute position within the parent node". To force positioning to the bottom of an entire page, you often must use other nodes, above the "footer" parent node, to force it to be pushed down. That's also influenced by the default nature of the parent node, and it in turn influences the parent(s). Div, for instance, as a parent of the absolute positioned child node, will stretch as far as it has to, to let its child get attached to the given edge. That stretching, however, will also change the floating and wrapping of the absolutely positioned node's siblings. This could also mean that position:absolute;bottom:0; will (correctly) end up being the bottom of the window when the page was drawn, and not the bottom of the page itself. That's correct, by nature of the parent containing the child.

Here is W3's explaination of absolute positioning, with visual examples.

If it is already set to top, and you want it at the bottom use top:auto;bottom:5pt; to turn off "top".
width Length of its x-axis.
min-width Be at least this wide.
max-width Be no wider than this.
height Length of its y-axis.
min-height Be at least this tall.
max-height Be no taller than this. Use max-height:none; if it has a max-height you want to remove.

padding Force empty space inside of an element.
margin Force empty space outside of an element.

border Style its edge.
-moz-border-radius Give the border (which you set separately, as above) a curve. The curve is determined by a circle which has the radius of the px value you give this property. So, each corner is sort-of wrapped around the corresponding 90-degree arc of the circle.
Be sure to read that this isn't perfect.
-moz-border-radius-topleft
-moz-border-radius-topright
-moz-border-radius-bottomleft
-moz-border-radius-bottomright

outline Style its edge outside of the border. This is the dotted line you see around active links, so to turn that off, use: a:active{outline:none!important;}
padding margin border outline border outline border -moz-border-radius


padding-top padding-right padding-bottom padding-left
{padding:0 1px 5pt 4em}
0=top
1px=right
5pt=bottom
4em=left

{padding:0 1px}
0=top/bottom
1px=left/right

font-family Change the font. font-family:arial, 'lucida console', sans-serif;
font-style normal italic oblique
font-size Use the usual measurements.
font-size-adjust Use a decimal in range 0 to 1. font-size-adjust:.46;
cursor auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help progress
opacity In the decimal range 0 to 1, or a percentage.
z-index Make something z-index:1; then another 2 and the 2 will be on top of 1
visibility visible hidden collapse If you want to make something hidden but still take up space.
overflow visible hidden auto scroll

-moz-box-ordinal-group change the order of menuitems buttons and whatnot (lower first higher last)
-moz-box-direction normal reverse, change the directions of stuff
-moz-box-orient horizontal vertical, make something vertical or horizontal
-moz-appearance none button menu and others, sometimes needs {-moz-appearance:none} to change some firefox controls

content used with :before or :after to add text, images, and counter numbers.
para1

para2

content:attr(href);
using attr

h4 { counter-increment: h !important; }
h4:before { content: "(" counter(h) "). " !important; }
That is used on this tutorial page, to number the <h4> headers, corresponding to the Table of Contents.
  }
}
  • Closes the document style.

Local Resources (files) in Firefox's Paths Top of this page.

Profile directory and program directory are completely separate directories.

chrome://

You can use Chrome List to find image resources you see in FireFox or extensions.

chrome://path/ These paths are somewhat relative to the user profile directory, but the "chrome" URI (Universal Resource Identifier), scheme is used because most of these files are being pulled, when needed, directly from ZIP archives.

resource://

resource://gre/path/ These paths are relative to the program directory.

These paths are supposed to be restricted to local JavaScript space, with limited accessibility. The bug advisory suggests that, as always, such ideals are not guarantees. You can add files to these paths, but should limit those files to the same sort that are found there already. Namely, images and such.

file:///

file:///C:/path/to/file These are exactly what they look like. The extra / is required, so take note of it.

How NOT To Style Top of this page.

about:blank

Most people seem to think that about:blank is only used for new/empty tabs, when they specify that as home page in browser options. That is, of course, completely false. About:blank is in fact used in MANY places where an HTML document structure is needed, but one has not been given by document/element default behavior, or where a place-holder is needed before a document loads (which is why you can use it in new tabs, it actually IS in all new tabs, before the document loads).

About:blank is used by Web Developer Toolbar, "View Style Information".
screenshot screenshot screenshot

About:blank is used by NoScript, as a place holder for embedded objects.
screenshot screenshot

Look, I just put your about:blank on my page:

Don't place content on about:blank, such as with Greasemonkey. Don't place large images on about:blank because it looks cool in new tabs. About:blank can appear anywhere. If a page takes forever to load, and it is a complex <iframe> & JavaScript application like GMail, and you are using an about:blank style, now you know why.

Customize Stylish Top of this page.

Add a search box to Stylish editor

There was a forum request for a search function in the stylish editor.

You can use Chrome List, to find the profile "stylish/content/" directory, and replace that edit.xul with this one. The copy provided here includes the missing "line 36", mentioned in the forum thread. After you have searched for a string, F3 sends you to the next match. Focus is sent to the editor textarea, when the highlight occurs.

screenshot screenshot screenshot

A single stylish.rdf on your LAN  

There was a forum request for remote storage of stylish.rdf, for sharing the file across a LAN, and further discussion of it. Those threads cover the basics. You can do this, and indeed Stylish is already programmed to do it. Their are complications, however.

  1. Stylish can not upload the file anywhere, you have to do it yourself.
  2. Stylish can not write to a remote file, it can only read it.
  3. The configuration involved has no GUI front-end.

You can use Edit Config Files, to open your current profile directory, if you need the easy button for that.

screenshot screenshot
Uploading to an FTP

Linux users, I suggest you make a symbolic link, with the program command:
ln -s /path/to/stylish.rdf /home/you/new/safer/path/

Then, create a shell script to upload the file.

Windows users have to deal with the file where it is. Create a batch file containing this line:
ftp -v -s:stylish-upload-commands.txt IP.TO.YOUR.FTP

It will be useful to know what the ftp command does, so on Windows command line, do:
ftp -h

The "-s:" tells Windows FTP command to use that file as a source of commands to do on the FTP when it connects. So, in that file, you would write something like this:

username
password
cd /path/to/upload/to
type binary
put "C:\path_to\Mozilla\Firefox\Profiles\profile_name\stylish.rdf"
quit

The precise commands depend upon the FTP daemon (server) you are connecting to. Those, above, were for mine, which is a Linux Two-FTP daemon. Create a shortcut to your batch file, and run it when you have made changes to your stylish.rdf, which you want to publish across your LAN.

Serving the file from the source PC

With an FTP or HTTP daemon (server) already running on the PC from which you want to share stylish.rdf, and that PC's daemon is accessible across the LAN, you simply create a shell script (or Windows batch) to copy the file from your profile directory, into the directory path from which you will access it on the LAN.

Now that you have a somewhat automated way to keep the remotely accessible stylish.rdf up to date, check that the file is accessible. Since I have Apache running on the same box as the FTP daemon I mentioned, I put stylish.rdf in the home http path of the username with which I uploaded the file. So, the path to stylish.rdf ended up being:

http://LANIP/~username/stylish/stylish.rdf

Now, browse to about:config, search (filter) for stylish, and enter your FTP or HTTP url as the value of key, "extensions.stylish.fileURL". If you need to access the file via FTP, and the FTP username requires a password, the URL format is:

ftp://username:password@LANIP/path/to/stylish.rdf

Restart Firefox, and you're done.

screenshot screenshot screenshot

After Stylish Top of this page.

Next Steps
Greasemonkey & UserScripts: With or without Stylish, there is UserChrome.js, extended by Greasemonkey.

Document Log Top of this page.

Dec 20 2007 ChoGGi

[first version]

Dec 24 2007 ChoGGi

(merry christmas, dont drink it all in one place)

Dec 28 2007 whatrevolution

  • Resort, more content.

Jan 03 2008 whatrevolution

  • Completed most HTML cleanup.
  • More content.

Jan 05 2008 whatrevolution

  • More accurate data about resource://.
  • Added extensions.
  • Removed !important from style.css.

Jan 06 2008 whatrevolution

  • Completed CSS cleanup.
  • Explained edit.xul search function.
  • Explained remote storage of stylish.rdf.

Jan 07 2008 whatrevolution

  • Included Valacar's selector specificity recommendations.
  • Explained Mozilla CSS defaults.
  • Expanded most content.
  • Added themes.js.
  • Added my old silver frame, from 2001.

Jan 11 2008 whatrevolution

  • Added more information for adjacent sibling selectors.
  • Began using "modified:" anchors to mark changes in existing text, which may influence accuracy or understanding of the material.

Jan 23 2008 whatrevolution

Jan 25 2008 whatrevolution

  • Added <div class="chapter">, fixed HTML format to match that.
  • Added FAQ.
  • Tweaking document tag nesting, more classing.

Jan 27 2008 whatrevolution

Jan 29 2008 whatrevolution

Feb 05 2008 whatrevolution

Feb 06 2008 whatrevolution

Feb 07 2008 whatrevolution

Feb 23 2008 whatrevolution

Document To Do Top of this page.

Notes & Licensing Top of this page.

Notes

Licensing

This document was derived from an original, located here, and includes other texts, which are linked and credited in-line.

The document text, and instructional imagery relevant to document text, which I, Daniel Ritchie, can legally claim possession of, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Creative Commons License

Decorative images presented with this document, which I, Daniel Ritchie, can legally claim possession, are not released for licensing. Decorative images presented with this document are Copyright © 2008, Daniel Ritchie. All rights reserved.

 

Licensing

Any content of any medium presented with this document which I, Daniel Ritchie, can legally claim ownership is not released for licensing unless explicitly stated otherwise. Any content of any medium presented with this document is Copyright © 2009 Daniel Ritchie. All rights reserved.

Anything which carries different or specific licensing is marked thusly. Anything which I can not legally claim as my own should be assumed as retaining its ownership and licensing to the extent of applicable law.

corner Site Uptime corner