Hugh McGuire
This chapter will cover how to insert and customize tables and textboxes in your book in Pressbooks.
How to Create Tables in Pressbooks
For best results including tables in your book, use our Table Creator tool in the Visual Editor.
Log in to your book. Go to Text / Organize and click on the chapter in which you would like to add a table.
Click on the toggle bar at the top right to show the full formatting toolbar.
Then use the Table Creator tool at the bottom left to create a table in your book.
Once you have created your table and filled it with text, you can add styles such as headings as you would normally, by highlighting the text and choosing a style from the dropdown menu in the toolbar.
To edit the table in other ways, place your cursor in any cell and click on the Table Creator button once again. From this menu you can:
- Insert another table within a cell
- Access the table properties (see below)
- Delete the entire table
- Edit cell, row and column properties
- Merge and split cells
- Add and remove rows and columns
- Copy, cut and paste rows and columns
Table Properties
To access your table properties, click anywhere in the table, then click the Table icon on the visual editor toolbar. From the dropdown menu, select Table properties.
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
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, this width size remains static.
In digital versions of your book (for instance, your webbook or EPUB file) a table with a width set by percentage 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 that view 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 the page and end at the left and right margins.
You can increase or decrease your table’s width by changing the percentage or settings 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
A table with a 50% width would render like this in the webbook:
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.
Tables with custom heights may look like this in your webbook:
Adjust Cell Padding & Spacing
Change Border Weight
You can increase or decrease the weight of your border by changing the quantity next to Border in the Table Properties window.
The default weight for the border is “1.” The higher the number, the more thick your table border will be.
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.
The caption will display below your table in your Pressbooks webbook.
In your ebook and print exports, the caption will display on top of the table.
Alignment
You can change the alignment of your table by clicking on the Alignment dropdown menu in the Table Properties menu.
The default alignment for all tables is “None.” You can change the alignment to Left or Right.
Your aligned tables should look like this in your webbook and exports:
Right and left aligned tables will also automatically have body text wrap around them in your webbook.
This wrapping feature is not yet available for exports other than the webbook.
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.
All tables default to the Standard class. You can choose from four classes:
- Standard
- No lines
- Lines
- Shaded
Be sure to click OK after you make any changes to the class.
How to Create Textboxes in Pressbooks
To add a textbox to your post, click on the toggle bar at the top right to show the full formatting toolbar.
Then find the “Textboxes” menu 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. Some of the more specialized styles include:
Learning Objectives
Type your learning objectives here.
- First
- Second
Key Takeaways
Type your key takeaways here.
- First
- Second
Exercises
Type your exercises here.
- First
- Second
Examples
Type your examples here.
- First
- Second
How To Customize Your Textbox Colors
You can customize your textbox colors in Pressbooks on four themes:
- Clarke
- Asimov
- Jacobs
- McLuhan
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 Select Color next to the element you’d like to change (Header Color, Header Background, or Background)
This opens up the color picker. You can input your own color hex code, choose a color from the bottom row, pick a hue from the spectrum, and pick a shade from the sidebar. Click Default to return the element color to its default.
4. Click Save Changes at the bottom of the 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. For more on this, see our guide chapter on customizing your CSS.
NOTE: Some textboxes can be a little temperamental; in particular the standard and shaded styles don’t like you hitting “Enter,” which will create a new textbox below the existing one. To get around this, you need to use a soft return by hitting “Shift+Enter” to get a new line.
Prefer to watch and learn? Here’s a brief visual intro to adding textboxes and tables in Pressbooks.