Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content

Tables

Table Cell Styles

While using the table.min.js plugin it is possible to add custom style on the selected table cell inside the WYSIWYG HTML editor.

table-cell-styles

Try it yourself:

The classes should be defined in CSS, otherwise no changes will be visible on the table cell's appearance.


You can define your own table cell styles using the tableCellStyles option. This option is an Object where the key represents the class name and its value is the style name that appears in the dropdown list. It is important to have unique keys otherwise they will not work properly.

By default you can select multiple table cell styles at a time. If you want to toggle them and allow only one style to be selected at a time use the tableCellMultipleStyles option.

Edit in JSFiddle

HTML

<div id="froala-editor">
  <p>The classes should be defined in CSS, otherwise no changes will be visible on the table cell's appearance.</p>
  <table style="width: 100%;">
    <tbody>
      <tr>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
      </tr>
      <tr>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
        <td style="width: 25%;"></td>
      </tr>
    </tbody>
  </table>
</div>

CSS

<style>
  .class1 {
    text-align: center;
    color: red;
  }

  .class2 {
    font-weight: 300;
    font-size: 16px;
  }
</style>

JAVASCRIPT

<script>
  $(function() {
    $('div#froala-editor').froalaEditor({
      // Define new table cell styles.
      tableCellStyles: {
        class1: 'Class 1',
        class2: 'Class 2'
      },
    })
  });
</script>
Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.