13 Replies Latest reply on Feb 12, 2008 4:58 AM by CeeEllBee

    Conditional Text Question

      Is it possible to make a style within the CSS conditional? Rather than mark lines of text as conditional (not for print), I'm wondering whether I can simply apply a style to them and indicate only one time that the style itself should not print.
      I'm outputting webhelp from RH7.
        • 1. Re: Conditional Text Question
          Peter Grainge Adobe Community Professional
          No way that I am aware of.

          You can specify a style that appears in the editor but not in any output. However, I believe you want the content to only be hidden in the printed output.

          I am not clear though as to how that would be an advantage. One way you apply a tag, the other way you apply a style. Either way requires much the same amount of work.

          What you could do is apply a CSS style called 'noprint'. When you generate your Word document map to a style in your template called 'noprint' and then use Word to find all paragraphs with that style and delete them.

          • 2. Re: Conditional Text Question
            Pete Lees Level 2

            It sounds like you want to use a media-specific style, as in the example below. Anything that is tagged with the style ScreenOnly is visible onscreen but hidden when printed.

            More information here:


            • 3. Re: Conditional Text Question
              CeeEllBee Level 1
              Thanks to both Peter and Pete, or should I say Repete?
              I plan to use a link labeled 'top' that goes to a bookmark at the very start of the page. This will appear only in long topics. I don't want the 'top' link to appear in the PDF output. I completely understand that styling the link will probably take as much time as marking it conditional; however, I am hoping to minimize the likelihood of forgetting the conditional tag. Because 'top' is already a style, I'd like to knock it off in one step.
              I'll take a look at the code.
              Thanks again.
              • 4. Re: Conditional Text Question
                Peter Grainge Adobe Community Professional
                So this style will never appear in any output?

                If that is the case try

                P.HiddenBookmark {visibility: hidden;}

                You don't have to call it HiddenBookmark. Change that to whatever you want.

                That will allow you to see it in WYSIWYG but not in any output, online or printed.

                • 5. Re: Conditional Text Question
                  RoboWizard Level 4
                  Hi ConTextCB

                  As far as your bookmark goes, perhaps you may also consider changing your approach. You can easily simplify this by omitting the actual bookmark. For example, if it's named 'Top'. Then where your links formerly pointed to #Top, amend them to simply point at #. The end result should be a cleaner behavior, less code and less to keep in mind as there is no need to create the bookmark. Pointing to # simply causes the page to reload and display from the beginning.

                  Just a thought... Rick
                  • 6. Re: Conditional Text Question
                    CeeEllBee Level 1
                    Hi Peter,
                    I do want the 'top' tag to appear in the Webhelp output, just not the PDF output. So, for my edification, can you explain a bit more about the P.HiddenBookmark/ Where do I add that and where do I specify the hidden parameter?
                    Thanks again.
                    • 7. Re: Conditional Text Question
                      CeeEllBee Level 1
                      Thanks for the tip. I've been using RH for several years and never knew about the #! How humbling. Great tip.
                      • 8. Re: Conditional Text Question
                        Peter Grainge Adobe Community Professional
                        I think this has been overtaken by Rick's suggestion but the method I suggested will apply to all outputs so it is of no use if you want it to appear in your webhelp. Otherwise you would just add visibility: hidden to the style definition.

                        • 9. Re: Conditional Text Question
                          RoboWizard Level 4
                          Hi Peter

                          Hmmm, I wouldn't think my suggestion would have changed anything with respect to what prints or what you were talking about with respect to hiding things during print. I was only offering a way to simplify the page. What I suggested would only apply to what appears totally behind the scenes, not the visible part. For example, yes we eliminate one bookmark, but nobody sees that. The link still remains.

                          So everything you were discussing before still applies.

                          Cheers all... Rick
                          • 10. Re: Conditional Text Question
                            Peter Grainge Adobe Community Professional
                            I wasn't suggesting it would. I was simply advising ConTextCB about using the hidden style I had suggested earlier. Nothing whatever to do with your reply.

                            • 11. Re: Conditional Text Question
                              Peter Grainge Adobe Community Professional
                              Out of curiosity I tried the idea of specifying two style sheets. RH will only work with the style sheet that is specified in Topic Properties. It ignores any other references added in code/html view.

                              • 12. Re: Conditional Text Question
                                MergeThis Level 4
                                First, RH doesn't always interpret the @media function properly.

                                Second, I think you're doing yourself a disservice by ignoring the use of conditionals in a situation that is tailor-made for them. Once you have set the proper conditionals in your WebHelp SSLayout and in your PrintDoc SSLayout, there's no "likelihood of forgetting the conditional tag," is there?

                                If there's anything I've learned over the years using HATs, it's these things:

                                1. What's the simplest to maintain...tomorrow...next week...next month...as the project grows and grows?
                                2. How does this HAT handle this (HTML, CSS, JavaScript, etc.) feature?
                                3. Just because you can, doesn't mean you should.

                                Good luck,
                                • 13. Re: Conditional Text Question
                                  CeeEllBee Level 1
                                  Thanks to everyone for the feedback. I will be using conditional tags...I certainly understand the value they offer and didn't mean to imply otherwise. Just trying to do my due dilgence.