Skip to main content
Participant
January 22, 2008
Question

Multiple stylesheets per topic

  • January 22, 2008
  • 3 replies
  • 1030 views
Hello,

I like to create multiple stylesheets for management purposes, rather than having one very very large stylesheet which can be used for all topics in my help project. Is there any way RoboHelp can support multiple stylesheets per topic? I also want to avoid duplication of rules between stylesheets, so using single different stylesheets for different topics is not a good solution. In particular, I'd like to have a single 'general' stylesheet to provide my 'general' formatting. Then, some topics will include an additional supplemental stylesheet to provide specific formatting.

Currently, for these topics where I need special formatting, I need to make the rules unique, and add them to my standard (now growing very large) stylesheet.

Thanks in advance!

Mitch
    This topic has been closed for replies.

    3 replies

    MitcheljhAuthor
    Participant
    January 23, 2008
    Hello Leon,

    I don't want to start an argument on this topic, but I would like to quote a couple of experts in the area of stylesheets, then quote the W3C itself, since you mentioned them.

    Simon Collison, from Beginning CSS Web Development, Page 10:
    Multiple Style Sheets:
    Consider a style sheet that contains all of the rules you've created for an entire site. Let's say that the site is equivalent in size to the BBC web site, which is very, very big indeed. All the styles required would result in one long, unmanageable style sheet, so splitting the style sheet into manageable chunks is a much better option here.

    Andy Budd, CSS Mastery, page 24
    For a simple website, you can get away with using a single CSS file. With larger and more complicated sites, it can be a good idea to separate your styles for ease of maintenance. How you separate your styles is a matter of choice. I generally have one CSS file for the basic layout and another for typography and design embellishment. This way, once the layout is set, I rarely have to go back and change the layout style sheet. This also protects my layout styles sheet from accidentally being altered and breaking.
    You can abstract things further by creating a separate CSS file for color. Then, if you want to offer different color themes, it is easy to create a new color style sheet. If you have lots of forms on your site, you may want to create a separate CSS file for all of your form styles. You can then link that file only when it is needed, thus reducing the initial download overhead. If you have some pages on your site that are very distinct from the rest of your site, you may want to consider splitting these off into their own CSS files. For instance, if your homepage layout is very different from the rest of the site, you may want to create a separate CSS file for the homepage.

    Now, if you'd like to visit http://www.w3.org/TR/html401/present/styles.html#h-14.3.1
    you'll read:
    14.3.1 Preferred and alternate style sheets
    HTML allows authors to associate any number of external style sheets with a document. The style sheet language defines how multiple external style sheets interact (for example, the CSS "cascade" rules).


    MergeThis
    Inspiring
    January 23, 2008
    whatever...
    January 23, 2008
    Mitchel, that's really interesting news for me. Like Leon, I always assumed that stylesheets were one per .htm.

    I'm not sure this will change how I use RoboHelp - in our linked help projects (some very large), my company uses different templates for different topic types, which gives us a little bit of stylesheet choice (one .css per template). I think the whole point is to limit style flexibility, since we have so many people working on related help files.

    But I can't wait to try this in Dreamweaver at home. I'm thinking about character set add-ons that don't require resetting my PC to the local language. (No, I don't mean getting around UTF-8. I mean Egyptian hieroglyphs. And if you tell me there's a UTF-8 encoding for ancient Egyptian, I'll believe you!)

    Thanks,
    Elisa
    MitcheljhAuthor
    Participant
    January 23, 2008
    Thanks for the suggestions Peter & MergeThis,

    I have tried placing an @import rule in my 'extra' stylesheet's to import my main spreadsheet, but that didn't seem to work.
    Yes,MergeThis, I do end up using the rules in my 'extra' smaller stylesheets more than once, so I was hoping to include them in the topics that needed them. For example, in some of my topics, I have examples. So, I was hoping to create a stylesheet called examples.css, and use it (with my common stylesheet) with all those topics which have examples. In other topics, I have other special type of formatting needs, so I'd like to do the same.

    I have used the header in the past to place special styles, but then I need to place those same 'example' rules in all topics which have examples, which is a lot of duplication. But, the topics with examples are still a small fraction of my total topics, so I didn't want to place those rules in my main stylesheet.

    I'll probably just copy and paste those special rules in the headers of those topics that need them for now. Maybe a future version of RH will allow multiple stylesheets per topic. Thanks again for the help and suggestions! I've gotten a lot of my problems solved just by looking through previous posts here.

    Mitch
    MergeThis
    Inspiring
    January 23, 2008
    You say "Maybe a future version of RH will allow multiple stylesheets per topic." I doubt that, because CSS and HTML are the purview of the standards-setting W3 consortium.

    I still maintain that only one CSS stylesheet, with all styles in it, is your best bet, particularly for maintenance. So what if 12 out of the 40 styles are not used in this topic, or 3 others are not used in that one? Those styles just get ignored when generating that topic, period.

    The only benefit I can see from multiple stylesheets would be for multiple media output (print, online, handheld, etc.).


    Good luck,
    Leon
    Peter Grainge
    Community Expert
    Community Expert
    January 22, 2008
    Welcome to the forum.

    Create a test project.

    Under the existing stylesheet, create a reference to another stylesheet.

    I have my doubts about it working and you will have to avoid duplicated styles. If it does work in source, check the output. Doubt the two will get referenced.

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    MergeThis
    Inspiring
    January 22, 2008
    You say: "I need to make the rules unique, and add them to my standard (now growing very large) stylesheet."

    It doesn't matter how large the stylesheet gets, it's only a text file. I would prefer to keep everything together in the same file, because no matter how unique some of those rules are, you'll probably end up using them elsewhere, eventually. Wouldn't you like to be able to change one css element only, when the font or the indent needs modification?

    Of course, you know you can add topic-specific css into each topic's HEAD section, right? Those css elements would work with your "generic" external stylesheet (and override it as you wish).


    Good luck,
    Leon