Add a table to an HTML page
Build this trail guide on the About page of the Trail Notes practice website. In Phoenix Pro, you'll work in Live Preview. In Community (free), you'll edit the HTML beside it. Both methods work on Windows, macOS, and Linux.
Open the finished table on its own.
Click or tap any screenshot to open it full size.
1. Open the About page
If you already have Trail Notes open, click about.html and start adding the table.
-
Download the Trail Notes practice website. On Windows, right-click the ZIP and choose Extract All. On macOS, double-click the ZIP in Finder. On Linux, open it in your archive manager and choose Extract.
-
In Phoenix Code, choose File → Open Folder…. Select the folder that contains
about.html,contact.html, andindex.html. If you see anotherfirst-websitefolder inside the first one, open that inner folder. In the file list on the left, click about.html. -
Look for Small walks. Good stories. in Live Preview. If the preview is closed, click the lightning bolt on the right. If Phoenix Code asks whether you trust the authors of this practice project, click Trust & Execute Preview for first-website. If you see the home page, click about.html again.
You'll put the table between the bulleted list and Visit the contact page.
2. Add the first trail
- Phoenix Pro
- Community (free)
Insert the table in Design Mode
Watch the table take shape in Live Preview. The recording starts with about.html open in Design Mode and ends with both trails saved.
-
Click the maximize icon in the Live Preview toolbar to enter Design Mode. If the pen is gray, click it. The orange pen means Edit Mode is on.
-
Click Visit the contact page once to select the link. On the blue toolbar that appears, click + (Insert Element). Choose Before so the table will sit above the link.
-
Type
tablein Search elements. Click Table, the result with the grid icon. It adds two column headings and one row. -
On the new table's blue toolbar, click table to open Element Properties. Under Class, click Add a class…, type
trail-table, and press Enter. If the input is closed, click + to open it. The headings appear on a pale green band and the distances line up on the right. Close Element Properties with its ×. -
Double-click Header 1, select its text, type
Trail, and press Enter. Change Header 2 toDistancethe same way. In the row below, change Cell 1 toPine Loopand Cell 2 to2 km. -
Give the table a caption. Click Trail once, then click the up arrow (Select Parent) on the blue toolbar twice. The toolbar label changes from
th(one heading) totr(one row) tothead(the heading section). -
With
theadselected, click +, choose Before, and typecaptionin Search elements. Click Create<caption>. Double-click the new words caption content in the illustrated banner, replace them withTrail distances, and press Enter. -
Click Save File beside the file list. Check that Trail distances appears beside the hills and the first row reads Pine Loop and 2 km.
Insert the table in HTML
Watch where to paste each code sample in about.html. The recording starts with the editor and Live Preview side by side. You can copy both samples from the steps below.
-
Keep the code and Live Preview side by side. If the preview fills the window, click the restore icon. Open the down arrow beside the pen and choose Highlight Mode. In the preview, click the last bullet, Change the colors in styles.css. Phoenix Code moves the cursor to that bullet in
about.html. -
Look at the next line for
</ul>, the end of the bulleted list. Click just after its>and press Enter. -
Use the copy button at the top right of this code block. Return to the blank line and choose Edit → Paste. The opening line's
class="trail-table"tells the browser to use the trail design from the practice site's stylesheet.<table class="trail-table"><caption>Trail distances</caption><thead><tr><th scope="col">Trail</th><th scope="col">Distance</th></tr></thead><tbody><tr><td>Pine Loop</td><td>2 km</td></tr></tbody></table> -
Choose File → Save File. Look below the bullets in Live Preview. The illustrated banner shows Trail distances, the table's caption. Below it, the first row reads Pine Loop under Trail and 2 km under Distance.
Using an older Trail Notes project and seeing a plain table?
Open the current practice stylesheet. Find the comment /* Trail table */ near the end. Copy from that comment through the last closing brace, }. In Phoenix Code, paste those rules at the end of your own styles.css and choose File → Save File. Click about.html again to see the design. The banner uses the practice site's images/trail.svg illustration.
3. Change a cell and add a row
A cell is one entry in the table. You'll change the first distance and give the second trail its own row.
- Phoenix Pro
- Community (free)
Duplicate a row in the preview
-
Double-click 2 km, change it to
3 km, and press Enter. -
Click Pine Loop once. The blue toolbar shows
td, the tag for a cell. Click the up arrow (Select Parent) once. Check that the toolbar now showstr, the tag for the whole row. -
Click Duplicate, the overlapping squares with a plus on the blue toolbar. A second row appears with the same trail and distance.
-
In the second row, double-click Pine Loop, change it to
Lake Walk, and press Enter. Change its distance to4 kmthe same way. -
Click Save File. Click the pen button to turn off Edit Mode and see the finished table.
Add a row in HTML
-
In
<td>2 km</td>, change just2 kmto3 km. Keep the<td>and</td>tags around the value. -
On the next line, click just after
</tr>and press Enter. That tag ends the Pine Loop row. Paste this new row on the blank line, above</tbody>.<tr><td>Lake Walk</td><td>4 km</td></tr> -
Choose File → Save File.
Check the two rows in Live Preview. The first should read Pine Loop — 3 km, and the second Lake Walk — 4 km. You can also open the saved about.html in a browser. The Contact link should still be directly below the table.
If you're editing a README.md file, follow Make a Markdown table with aligned columns.







