Skip navigation
Currently Being Moderated

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

Jan 15, 2011 6:28 PM

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?

 
Replies
  • Currently Being Moderated
    Jan 16, 2011 12:32 AM   in reply to jaggedpeak

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 17, 2011 12:23 AM   in reply to jaggedpeak

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2013 11:25 AM   in reply to Willam van Weelden

    I have tried the suggestions above in rh9, including adding the stylesheet to the snippet. My great frustration involves the style for representing code, which includes a 1px border. When this style is applied in a normal topic (no snippet) the html tag is simply a p class in the generated html file:

    <p class="code">

     

    For some bizarre reason, when there is a code block in a snippet, inserted into a page & published as WebHelp, there is a mysterious addition to the html tag making the border 4px wide (see below, copied from the generated html)

    <p class="code" style="

    font-size:10pt;

    font-family:'Courier New' , Courier, monospace;

    margin-top:0pt;

    margin-bottom:6pt;

    color:#000000;

    border:1pt solid #c0c0c0;

    padding:8px 5px;

    border-width:4px;">

    I went so far as to actually open & search the entire text of the CSS to see if there was some random style being applied inadvertently, and there is NO style which includes a "border-width:4px" formatting component. I am stumped! Any suggestions?

    Suzie

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 24, 2013 1:50 AM   in reply to Smirtuzie

    I just set up a Rh9 test adding your style to the CSS and then applied it to the content of a snippet. In both the source and output topic all I am seeing is <p class="code">.

     

    Try again in a new project using the default.css to see if it works OK then. If it does, then it has to be something else in your snippet or css causing the style stuff to be added. Are you sure there is no inline styling kicking in?

     


    See www.grainge.org for RoboHelp and Authoring tips

     

     

    @petergrainge

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 26, 2013 6:25 AM   in reply to Peter Grainge

    Peter,

     

    Thank you for taking the time to test this. I will check again, but I could not see any inline styling when I look at the html if I recall correctly.

     

    Suzie

     

     

     

    SuzieMedders

     

    Technical Writer

     

    <http://omnibond.com/> OmnibondLogo

     

    Omnibond Systems LLC

    Post Office Box 793

    Pendleton, SC 29670

     

    <mailto:suzie@omnibond.com%0d> suzie@omnibond.com

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 26, 2013 6:27 AM   in reply to Peter Grainge

    Peter,

    Thank you for taking the time to test this. I'm encouraged that you got a different result. When I checked the html I didn't see any inline style applications. I will go back and look at it again. I decided to just leave it the way it was because it was taking so much of my time.

    I'll let you know what I find.

    Suzie

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points