Skip to main content
Inspiring
September 2, 2020
Answered

How to set width of table style (RH 2019, new UI)

  • September 2, 2020
  • 19 replies
  • 611 views

Hi, Everyone.

 

I'm creating a table style to create a "side bar" format. (See screenshot, right-hand column, beneath the image.)

 

 

I'd like to set the width in the style to be narrower. But I don't want to use pixels, afraid that would forfeit the responsive properties of my skin (Oceanic).

 

How do I do this? 

 

Thank you!

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

    This goes back on what I suggested earlier but it should resolve your issue.

     

    CREATING A TABLE STYLE

    1. Open you CSS file in the CSS editor.
    2. Right click on Table Styles and select New.
    3. Enter a name in Class, ignore Pseudo Class.
    4. Go to the Border settings.
    5. Set the type of border (usually solid), the colour and the width.
    6. Not how the preview is showing those settings around the outside of the table only.
    7. Now do the same in the Cell settings. Note that the preview will show two lines between cells.
    8. Go to the General settings and select Border Collapse > Collapse.
    9. At the top of the Properties you will see that all the above settings have been applied to Whole Table.
    10. Use the dropdown to create row and column specific settings.
    11. When done, click Save.

     

    USING THE STYLE

    At this stage I suggest you create a folder and topic called Scratchpad or suchlike.

    1. On a fresh line and not within another table, go to the toolbar and insert a table with the required number of rows and columns.
    2. In Properties > Styles select that table.

    It should appear as you want. You can apply styles within the cells and I prefer that approach rather than defining text in the table editor.

     

    TABLES WITHIN A TABLE

    Within another table, the styles may go wrong through inheritance. Identify the value that is wrong and add !important.

    For example, if the colour does not stick look at the CSS in source view, edit it as below.

    From

    border-color: #FF0000;

    To

    border-color: #FF0000 !important;

     

    19 replies

    Peter Grainge
    Community Expert
    Community Expert
    September 3, 2020

    ... and you know where to try it first don't you? 🙂

     

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Peter Grainge
    Community Expert
    Community Expert
    September 3, 2020

    What you seem to want is a two column table with no rows and no visible borders, correct?

     

    So you create a table using the toolbar icon that has just two columns and one row. It will have a simple black border.

     

    Leave that while you are authoring as it's easier to see what you are doing.

     

    When ready, Select > Table and set the border to transparent.

     

    Does that work?

     

     

     

     

     

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Inspiring
    September 3, 2020

    Hi, Amber and Peter.

     

    I don't know what I'm doing wrong. I've tried all of your suggestions. And the RH preview shows I've done it properly (screenshot):

     

    However, the styling does not appear in the output -- no border, no shading (screenshot):

     

     

    Here's the code view (screenshot):

     

     

    Strangely, I wanted to show you my new table style, "side_bar," in code view. However, it doesn't appear in the code view list (screenshot):

     

     

    But here are the CSS settings of the table style "side_bar" (screenshot):

     

     

    Notice that the CSS preview looks fine, above.

     

    Your thoughts?  Thank you.

     

    Community Expert
    September 3, 2020

    You can get the table style width to work if you do the following:

    1. Insert a table.

    2. Switch to the General panel

    3. Select Table

    4. Click the Clear Formatting icon next to the "Type" field.

    5. Apply your table style.

     

    This works because Robohelp 2019 New UI hard codes inline widths for each inserted table (I don't know why). 

     

    Freshly inserted table code:

     

     <table border="1" cellpadding="1" cellspacing="1" style="border-collapse:collapse; width:100%">
        <colgroup>
          <col style="width:100.00%" />
        </colgroup>
        <tbody>
          <tr>
            <td> </td>
          </tr>
        </tbody>
      </table>

     

     

    After Clear Formatting:

     

      <table border="1" cellpadding="1" cellspacing="1">
        <colgroup>
          <col/>
        </colgroup>
        <tbody>
          <tr>
            <td> </td>
          </tr>
        </tbody>
      </table>

     

    (You might need to make sure "border-collapse: collapse" is defined for your table style, I haven't tried it out with a multicell table.)

     

    EDIT: I forgot to add - but given you'll have to manually modify each table, you might as well just change the inline width as Peter advised, unless you're committed to clean code. 🙂  

    Inspiring
    September 2, 2020

    Yes!!  So, not only was I mistakenly doing this in the CSS. But I didn't know about the "Select Table" command, either. 

     

    Thanks much, Peter!

    Peter Grainge
    Community Expert
    Community Expert
    September 2, 2020

    Not in the CSS. Create the table and apply the settings in the Properties of that table. 

     

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Inspiring
    September 2, 2020

    Well, I thought I knew what I was doing . . .

     

    When I set the "width" under the Layout tab (screenshot), it doesn't do what I want. I'm trying to narrow the width of the table. (It's a single-cell table.)  How do I do that?

     

    Inspiring
    September 2, 2020

    Oh, yes, the test project!  I would've forgotten. 😞

     

    Thanks much, Peter. That's awesome I can just use pixels. If I use % values, what's the concept -- is it a percentage of the whole page? Or of the existing column? 

     

    Peter Grainge
    Community Expert
    Community Expert
    September 2, 2020

    Use Select Table and in the properties set the widths you want. I tend to use % values but you can use pixels. RoboHelp will adjust all the columns proportionally so you won't lose the responsiveness.

     

    Where's that test project to try it out? 🙂

     

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