Jul
14

Per Site User Stylesheets

Filed under: Asides | July 14th, 2004
Post

Give every site you visit a body ID, because everybody needs somebody. (6)

6 Responses

  • michael | July 14th, 2004 @ 12:44 pm

    I like the idea of using JavaScript to set the ID, and possibly turning it into a bookmarklet, but I wouldn’t necessarily use the site sig idea. If you set it up where you give the body an ID that you have set up in your user style sheet, you can use the bookmarklet/user stylesheet idea to globally override most of the settings that people wish they could change (i.e. fonts, colors, paragraph spacings,etc.). Where the whole idea breaks down is when CSS rule specificity is set to such a point that you can’t get at specific rules due to the cascade, and this is true of using a site sig on the BODY tag as well (if I’m not mistaken).

    Current score: 0
  • Matt | July 14th, 2004 @ 9:49 pm

    I imagine that’s where !important would come in handy.

    Current score: 0
  • Jeremy Dunck | July 15th, 2004 @ 7:31 am

    If user stylesheets take off, I can imagine “designers” who want to control their site appearance gratuitously using !important to remove your ability to override.

    You can’t save them all…

    Current score: 0
  • Matt | July 15th, 2004 @ 10:10 am

    Yeah but part of the cascading nature of stylesheets is that user stylesheets naturally have a high specificity, just like embedded stylesheets overrule external ones. I don’t remember exactly where they fall, maybe somenoe could enlighten usp

    Current score: 0
  • Gerrit | July 15th, 2004 @ 11:41 am

    uh-oh! Stop! Please don’t promote bad ideas like that. This hack is about as ugly as it gets. Wantonly altering the ID of elements of a document will break lots of things. Stateful navigation anyone?
    If you have to use a hack like this to enable per-site user-stylesheets, why not append a custom class to the class attribute of the html or body element? If you would use a random number in the classname, this would almost certainly not interfere with the document’s author stylesheets and/or scripts.
    Having said that, I don’t see why it would be necessary to modify the document structure at all. Omniweb 5’s per-site-preferences show that it’s possible.

    Current score: 0
  • Chris Neale | July 15th, 2004 @ 1:09 pm

    URIid adds an id attribute to the body tag only when the document itself doesn’t have one of its own.

    Current score: 0

Share your thoughts