![]() |
|
![]() |
Customize The Entire Web, StylishlyTable of Contents
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: FirefoxWhen Stylish is installed, follow these steps to enable Stylish userstyle installs from www.honestlyillustrated.com:
K-Meleon, Mozilla et. al.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.
Make my style change all pages?: Top of this page.That's called a "global style".
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.
Style this thing on that page?: Top of this page.With Web Developer Toolbar: Top of this page.These images are an example of using Web Developer Toolbar and Stylish, together:
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:
Select one URL and exclude another?: Top of this page.
What HTML tag does that select?: Top of this page.
Prerequisite Knowledge Top of this page.
Suggested Tools Top of this page.
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.
CSS Basics Top of this page.
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: 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.
{
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.orgI'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 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 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.cssWhile 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;
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-repeat no-repeat, so it doesn't tile, or repeat-x, or repeat-y, to only tile it on that axis. background-color Change background colour of an element (node/tag). color Change text colour. CSS color valuesWhere a color value is needed, you can use words: black lightblue, or any other CSS Color Name.RGB: rgb(123,213,43)
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 everyoneMake 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". 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. }
}
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".
About:blank is used by NoScript, as a place holder for embedded objects.
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 editorThere 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. A single stylish.rdf on your LANThere 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.
You can use Edit Config Files, to open your current profile directory, if you need the easy button for that. Uploading to an FTP
Linux users, I suggest you make a symbolic link, with the program command:
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:
It will be useful to know what the ftp command does, so on Windows command line, do:
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 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 PCWith 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.rdfNow, 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.rdfRestart Firefox, and you're done. After Stylish Top of this page.
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
Jan 03 2008 whatrevolution
Jan 05 2008 whatrevolution
Jan 06 2008 whatrevolution
Jan 07 2008 whatrevolution
Jan 11 2008 whatrevolution
Jan 23 2008 whatrevolution
Jan 25 2008 whatrevolution
Jan 27 2008 whatrevolution
Jan 29 2008 whatrevolution
Feb 05 2008 whatrevolution
Feb 06 2008 whatrevolutionFeb 07 2008 whatrevolutionFeb 23 2008 whatrevolutionDocument To Do Top of this page.
Notes & Licensing Top of this page.Notes
LicensingThis 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. 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. LicensingAny 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. |
||
![]() |
Site Uptime | ![]() |