"

21 Tables and Textboxes

Tables

Pressbooks offers two ways to create tables in your books. The first is through the visual editor toolbar, which allows you to create basic tables for all your book formats. The second method uses the TablePress plugin, which is available only on PressbooksEDU networks. The TablePress plugin lets you build dynamic, interactive tables which can be sorted, filtered, and searched in the webbook and exported as static tables to PDF and ebook formats.

Visual Editor Table Tool

To access the table tool, look for the table icon on the visual editor toolbar. Follow the steps below to create your table.

  1. Click the table icon on the visual editor toolbar
  2. Hover over Table and then select the initial row and column layout you’d like for your table from the grid that appears

Once you’ve selected the number of cells, the table tool will close and your table will appear. At this point you can now enter your content or style the table.

Image of the table creation tool in the visual editor of Pressbooks, showing the dropdown table menu, highlighting the table function with row and column selection.
Figure 1. Making a table in the visual editor in Pressbooks.

Table Structure

There are many options for customizing your table. To modify the structure of the table for Cells, Rows, or Columns, follow these steps:

  1. Click and highlight the cells, rows, or columns you wish to modify
  2. Open the table tool
  3. Hover over Cell, Row, or Column depending on your needs
  4. Select the action you want to occur
Image showing the "Table" dropdown menu in the visual editor in Pressbooks, highlighting the "Cell" options: table cell properties, merge table cells, and split table cell.
Figure 2. “Cell” dropdown options.
Image showing the "Table" dropdown menu in the visual editor in Pressbooks, highlighting the "Row" options: insert row before and after, delete row, table row properties, cut table row, copy table row, and paste table row before and after.
Figure 3. “Row” dropdown options.
Image of the "Table" dropdown menu in the visual editor in Pressbooks, highlighting the "Column" options: insert column before, insert column after, and delete column.
Figure 4. “Column” dropdown options.

This tool allows you to complete the following actions:

  • Insert another table within a cell
  • Edit cell, row, and column properties
  • Merge and split cells
  • Add and remove rows and columns
  • Copy, cut, and paste rows and columns

The two other settings that appear on the table menu include Delete table and Table properties. To delete your table, click anywhere inside the table, then open the table tool menu and select Delete table. For further styling options, click within the table and then select Table properties.

Table Properties

Image of the Table Properties menu from the visual editor in Pressbooks, with options to change the width, height, cell spacing, cell padding, caption, alignment, and class of the table.
Figure 5. Table properties menu.

Through Table Properties, you can:

  • Adjust the width and height of your table
  • Adjust the cell padding and cell spacing
  • Increase or decrease the weight of the border
  • Add a caption
  • Change the alignment
  • Change the class (lines, no lines, shaded, full grid, etc.)

Adjust Width and Height

Width

The width of your table is set as a percentage of the page size or as a pixel value. For print and fixed format export versions of your book, this width size remains static.

In responsive versions of your book (for instance, your webbook or EPUB file), tables with percentage widths will be responsive to the device. For example, a reader viewing the table on their phone will see a far narrower table than a reader who views the same table on a large computer. Both readers see the entire table within their screen.

A table set in pixels will be static on all exports and not responsive to the device. Actual displayed widths may also vary depending on the content inside the table. For instance, if the content inside the table exceeds the width percentage or pixel value you’ve set, the table will still expand past those parameters to display all of the content.

By default, the width of your table will be set at 100%. This means that the table will take up the entire width of its parent element (typically, the page) and end at the left and right margins. You can increase or decrease your table’s width by changing the percentage or setting a pixel value.

To set a percentage width: Enter “50%” (or other value) next to Width in the Table Properties window

To set a pixel width: Enter “50px” (or other value) next to Width in the Table Properties window

Height

Table height, by contrast, is measured only in pixels, or “px” because height is static across all export types.

There is a minimum height pixel value that you can set a table to, and the minimum height will depend on how many rows your table has. A two-row table, for example, cannot have a pixel height value of less than 50px; the table will return to the default size if a value lower than that is entered.

To set a pixel height: Enter “100px” (or other value) next to Height in the Table Properties window.

Table Captions

The table caption option can be enabled by checking the box next to Caption on the Table Properties window. Be sure to click “OK” after you’ve enabled this feature.

After, you’ll see a blank space above your table in the visual editor. Click in this space to type your table caption.

Image of a blank table in the visual editor in Pressbooks.
Figure 6. What a table looks like in the visual editor with the caption space above the table.

The caption will display below your table in your Pressbooks webbook.

In your e-book and print exports, the caption will display above the table.

Alignment

You can change the alignment of your table by clicking on the Alignment dropdown menu in Table Properties.

The default alignment for all tables is “None.” You can change the alignment to Left, Center, or Right.

Class

You can change the class of your table by clicking on the dropdown menu next to Class in the Table Properties window. Each class defines a preset look for the table.

Image showing the Table properties menu in Pressbooks, highlighting the "Class" dropdown options with the table classes: standard, no lines, lines, shaded, and full grid, with landscape options of each too.
Figure 7. Table class dropdown options.

All tables default to the Standard class. You can choose any of the following classes:

  • Standard
  • No lines
  • Lines
  • Shaded
  • Full Grid
  • Standard Lanscape*
  • No lines Landscape*
  • Lines Landscape*
  • Shaded Landscape*
  • Full Grid Landscape*

NOTE: Landscape table classes (denoted with an asterisk*) will only appear landscape in PDF format. These tables will display in e-book and webbook formats in normal portrait format.

 

Be sure to click “OK” after you make any changes to the class.

 

TablePress

Users on a PressbooksEDU network also have access to the TablePress tool. This plugin allows you to create and display dynamic tables in your webbook that users can sort, filter, and search within. For more information on TablePress, go to the TablePress website to learn more.

In your left sidebar menu, go to TablePress, then follow these steps:

  1. Select the Add New tab from the top of the page, or from the left sidebar menu
  2. Enter your table name and an optional description of the table, then select the number of rows and columns you’d like your table to have
  3. Click Add Table
Image of the left sidebar menu in Pressbooks, highlighting the TablePress section of the sidebar.
Figure 8. TablePress in the left sidebar menu.

Once you click Add Table, you’ll be brought to your new table and will be able to enter content into the cells. Find the table in the Table Content panel and click any cell to enter your data.

The TablePress plugin includes a plethora of settings to allow you to customize the table. Configure your table to the needs of your project using the Table Manipulation, Table, Table Options, and Features panels.

You can also choose to Copy Table, Export Table, or Delete Table using the tabs at the bottom of the page.

When your table is complete, click Save Changes at the top or bottom of the page. Saved tables will appear on the All Tables page.

Other Options

TablePress also allows you to perform a few other actions, available from the tabs at the top of the page:

  • Import: Import tables in CSV, HTML, JSON, XLS, or XLSX format into TablePress to place them in your book
  • Export: Export existing tables you’ve created in Pressbooks to your device as CSV, HTML, or JSON files
  • Plugin Options: Add Custom CSS to style your tables

Adding TablePress Tables to a Chapter

Once you’ve activated TablePress and created your table, you can follow these steps to place it in your chapter:

  1. Go to All Tables and find the table you’d like to place in the chapter
  2. Hover over the title of your table, then click Show Shortcode
  3. Copy the shortcode and click OK
  4. Navigate to your chapter
  5. Paste the shortcode into visual editor where you want the table to appear
  6. Save the chapter

The table won’t display in your visual editor; you’ll just see the shortcode.

However, the table will appear in your webbook when you view the chapter.

TablePress tables also appear in PDF and e-book exports.

 

Textboxes

The Pressbooks textbox tool allows you to place text with frames to have it stand apart from the rest of the text in the body of your book. The structure and color of textboxes may vary from theme to theme. You can also choose between standard textboxes and educational textboxes premade for examples, exercises, and other elements.

To add a textbox to your post, find the “Textboxes” dropdown menu in the Visual Editor toolbar and make your selection. This will insert an empty textbox into your post. Alternatively, you can highlight your text first, then choose the textbox style you need and see it appear with your text already inside.

Textboxes can serve many purposes, and Pressbooks has several preset styles to suit your needs, including many that are useful for textbooks and workbooks.

How To Customize Your Textbox Colors

To change your textbox colors from their default palette, follow these steps:

  1. Go to Appearance > Theme Options from the left-hand menu of your book’s dashboard
  2. Scroll down to see your customization options for Examples, Exercises, Key Takeaways, and Learning Objectives
  3. Click inside of the textbox showing the current color hex code of the element you’d like to change (Header Color, Header Background, or Background)
    1. This opens up the color picker. You can input your own color hex code, pick a hue from the spectrum, or change the opacity.
  4. Click “Save Changes” at the bottom of the Theme Options page

All textbox color customizations will affect every textbox of that specified type in your book. For example, if you change the Key Takeaways Header Background to green here, all Key Takeaways in your book will now have a green header background.

This change affects all export types. You can see the new, custom color textboxes in your visual editor.

 

Custom Textboxes

You can also insert a custom textbox using the textbox menu, which allows you to add a custom CSS class that you can then style in the CSS editor. You can also customize the existing styles if you’re confident with CSS.

 

This chapter is adapted from the Pressbooks User Guide, Chapter 93: Tables & Textboxes, published under a Creative Commons Attribution 4.0 International License.

License

Icon for the Creative Commons Attribution 4.0 International License

Getting Started with Open Educational Resources Copyright © 2019 by Mahrya Burnett, Jenay Solomon, Heather Healy is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.