Practical Plone 3: A Beginner's Guide to Building Powerful Websites
上QQ阅读APP看书,第一时间看更新

Controlling the layout of a page: tables

Let's say you have a long list of items that you want to display on a single web page, such as all the elements in the periodic chart. You could simply list them all out in a single vertical column, but that would make your page rather long, and force your site visitors to scroll down the page a great deal to see all of the content. This is where tables come in.

Tables create a grid of rows and columns into which you can place content and display text or images side-by-side. There are a few basic table styles, which control the appearance of the table, to choose from. Start by editing a page, and click on the following Insert table icon:

Controlling the layout of a page: tables

Note

A word of caution: You cannot superimpose a table over pre-existing content. If you insert the table on top of text, you'll lose all the content! You must start by creating the table first, and then add content into the table cells.

A window will pop up, to let you choose the Table Class. There are several to choose from, some of which look only slightly different from some of the others. Select the number of rows and columns, indicate whether you want to use headers for the table columns, and then click on Add Table.

Controlling the layout of a page: tables

At first you'll just see a tiny grid, but the table will re-size itself as you type text into the cells. Here are examples of what each Table Class looks like in practice. All of these have two rows, two columns, and the headings turned on:

Controlling the layout of a page: tables

As you can see, the differences are subtle in some cases, but you should be able to find a style that works for the layout that you are envisioning. It will take you some time to get used to working with Tables, so be patient. Experiment often, and don't forget to save your work!

Note

If you wish to add additional rows or columns to an existing table, simply click inside a table cell. Small x and some little arrows will appear. Up and down arrows add rows above or below the current row, and left and right arrows add columns to the left or right of the current column. The x is there in case you want to remove a row or a column from the table. Use Ctrl + Z to undo your work if you make a mistake.