Skip to main content
jaggedpeak
Inspiring
January 16, 2011
Answered

rh8: snippets: CSS styling - how is it done?

  • January 16, 2011
  • 1 reply
  • 1742 views

I've been working my way through a project with a lot of help here -- thanks all!

Now... I have a number of topics, and a lot of snippets that are used in them.

If I am in a topic, I can see all of my CSS character and paragraph styles, including a character style that I use for menu selections.

If I am in a snippet, I don't have those styles. I just get what I assume are the default styles.

I read in a page somewhere on the adobe site that the snippets will have the CSS applied to them from the topics in which they appear. That makes sense.

But... how then, does one tag the content in a snippet?

Snippet example:

Select Foo > Bar.

That's what I would *like* the snippet to look like when it appears in my topics. (All of my topics have a character style 'Selection' that is Bold/Red (for the sake of this question, at least :-)).

However, I don't have that character style available in the snippet.

What do I do?

    This topic has been closed for replies.
    Correct answer Peter Grainge

    You have to apply inline styles. If ever you need to change that, it's a bit like CSS in that you only have to change it once, in the snippet.

    You can apply classes in the snippet.

    Tables are more tricky and the easiest solution is to create what you want in a topic and paste it into a snippet. It will look wrong in the snippet but OK on preview and generation of a topic.


    See www.grainge.org for RoboHelp and Authoring tips

    @petergrainge

    1 reply

    Peter Grainge
    Community Expert
    Peter GraingeCommunity ExpertCorrect answer
    Community Expert
    January 16, 2011

    You have to apply inline styles. If ever you need to change that, it's a bit like CSS in that you only have to change it once, in the snippet.

    You can apply classes in the snippet.

    Tables are more tricky and the easiest solution is to create what you want in a topic and paste it into a snippet. It will look wrong in the snippet but OK on preview and generation of a topic.


    See www.grainge.org for RoboHelp and Authoring tips

    @petergrainge

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    jaggedpeak
    Inspiring
    January 16, 2011

    Thanks Peter, I thought it might be something like that.

    And thanks for the point about tables -- definitely worth knowing :-)

    Willam van Weelden
    Inspiring
    January 17, 2011

    Hi,

    In addition to Peter's answer, you can manually add a style sheet to a snippet. The style sheet is not used in the output, but you can select styles in the regular way.

    A snippet is just a .htm file with a different extension. To add a style sheet, go to HTML mode and add <link rel="stylesheet" type="text/css"  href="mycss.css" />

    The snippet is in the root of your project, so be sure to use the correct path. Save and go to WYSIWYG mode. The snippet is now correctly formatted and you can use the styles from your css.

    Greet,

    Willam