8 Replies Latest reply on Jan 24, 2008 5:17 AM by MergeThis

    Multiple stylesheets per topic

    Mitcheljh
      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
        • 1. Re: Multiple stylesheets per topic
          Peter Grainge Adobe Community Professional
          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.

          • 2. Re: Multiple stylesheets per topic
            MergeThis Level 4
            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
            • 3. Re: Multiple stylesheets per topic
              Mitcheljh Level 1
              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
              • 4. Re: Multiple stylesheets per topic
                MergeThis Level 4
                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
                • 5. Multiple stylesheets per topic
                  Mitcheljh Level 1
                  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).


                  • 6. Re: Multiple stylesheets per topic
                    MergeThis Level 4
                    whatever...
                    • 7. Re: Multiple stylesheets per topic
                      ElisaFnord Level 2
                      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
                      • 8. Re: Multiple stylesheets per topic
                        MergeThis Level 4
                        No argument here, Mitch. However, your meticulously researched references are specific to Web development, which can spawn incredibly large CSS files, particularly when creating intricate styling that replaces table and frame formatting (yes, I own a CSS book, myself). But are you working an online help project or a Web site? If a Website, you probably should look at a different editing software.

                        As to multiple style sheets in RH, try this:
                        1. Add another "link rel..." tag for an extra style sheet in the TrueCode of one topic. Click Save.
                        2. Switch to WYSIWYG mode, then back to TrueCode. What you should find is two identical style sheet lines. (In my test, RH duplicated the second, new line I had added.)

                        I guess I responded too quickly in the previous post; what I meant to say was that RH (at least X5.0.2, which we're using still) tends to restrict the kinds of things it will allow, partly because of what it has to do to your source files while it's generating multiple output layouts. In other words, you can do a lot with W3-approved HTML and CSS, but not necessarily in RH.

                        We have 7 writers working on a 42-project merged WebHelp project. I have a tough enough time riding herd on their occasional lapses into on-the-spot styling. At least I know that I only have to replace one CSS file across the enterprise to institute global changes. That CSS file, by the way, is only 565 lines in a text file of 14 KB.


                        Good luck,
                        Leon