Importing text into a table
Typing directly into table cells is relatively simple. You type data directly into a cell and then press Tab to position the text cursor in the next cell and so on. A more efficient way to add text is to import a .txt (text) file directly into a table. In this part of the lesson, you will import data into a new table and then apply an existing table style.
- Using the Standard Editing tool (), click in the large cell in the right side of the table. The blinking insertion point appears in the cell. This is the cell that spans three rows.
- Double-click on the Table object () in the Objects palette. The table is inserted into the cell.
- Using the Table Inspector, change the rows value to 3, if it’s not already.
- Using the Standard Editing tool, click on the upper left cell in the new table.
- Click on <td>, furthest to the right, in the source code hierarchy in the document bar at the bottom of the page.
- Choose Special > Table > Import Tab-delimited text. When the Open dialog window appears, browse to locate the Lesson03 folder
and choose the text file named tour.txt. Select Open.
The text is automatically input into appropriate rows and columns. The default setting is that each tab stop is automatically read as a new column, and each paragraph return is read as a new row.
You can change this default in the CoL Separator drop-down menu in the Open dialog window as you import the text. Other choices are Comma, Space, and Semicolon.
- Position your cursor over the right border of the table. When you see the double arrow icon () click and drag to make the table wider. A specific size is not necessary, just adjust the table to be larger and allow a better fit for the text.
- Insert the cursor into the cell containing the text “Tour the Campus,” then choose Special > Table > Select Cell.
- Press Shift+Right arrow twice, to span the column. Span the bottom left cell containing the text “Registration is required” using the same method.
- Choose File > Save and leave the file open for the next part of this lesson.
Applying a table style
You will now apply a table style to your new table.
- Select the top cell of the table.
- If the Table & Boxes palette is not visible, choose Window > Table & Boxes.
- From the Style drop-down menu, choose Blue. Then click Apply.
The Blue table style is applied to the cells of the table.
Placing text and images in the table
Now that you have a table, you will add images to the layout.
- Using the Standard Editing tool (), click in the upper left cell of the large table. This is the table created to form the layout of the Web page. The blinking insertion point appears in the cell.
- Double-click on the Image Object () located in the Basic section of the Objects palette. The Image Object appears where the insertion point was located.
- If the Inspector palette is not visible, choose Window > Inspector or use the shortcut Ctrl+1 (Windows)/Command+1 (Mac OS).
Using the Basic tab of Image Inspector, click on the Browse button (). When the Open dialog window appears, locate the image named virtechu_logo in the web-content folder inside the student
folder you created when the site was created. Click Open.
The Image object is replaced with the VirtechU logo.
- Using the Standard Editing tool, click on the VirtechU logo and choose Middle from the Alignment drop-down menu in the Basic tab of the Image Inspector.
- Using the Standard Editing tool (), click after the VirtechU logo to insert the type cursor. Press the spacebar once and type The place to learn technical skills.
Applying a Cascading Style Sheet to the cell
- Select the cell containing the VirtechU logo and headline text.
- If you do not see the CSS palette, choose Window > CSS to display the CSS palette. It may be docked below the Inspector. There are two class styles already created in this document. For more information
about creating a CSS class style, see Lesson 5, “Adding and Formatting Text.”
Since you have a cell selected, it gives you only one option: to apply the style to the entire cell. In the source code, a table cell is represented by the tag <td>, which stands for table data.
- Check the <td> checkbox to the right of headline. The text in the cell is now changed to represent the attributes assigned to the headline class style. You may have to undock the CSS palette in order to see the checkbox.
Completing the table
In this next section you will add the remaining imagery and text to complete this page.
- Position the site window so that you can see the list of files at the same time as your page. Then drag image_1.jpg from the site window to the second cell down on the left.
- Drag image_2.jpg into third cell down on the left.
- Drag image_3.jpg into last cell down on the left.
- Choose File > Open. When the Open dialog window appears, browse to locate and select the file named student.txt in the Lesson03 folder. Click Open.
- Select all the text under the dashed line on the text document and choose Edit > Copy. Choose File > Close to close the document.
- Return to the table1.html file. Using the Standard Editing tool (), click to the right of your “Tour the Campus” table, a large cursor appears. Press Return.
- Choose Edit > Paste. The copy appears under the table.
- With the cursor still blinking, press Ctrl+Enter (Windows and Mac OS). This selects the table cell.
- If the CSS palette is not already open, choose Window > CSS, and the CSS palette appears.
- Check the <td> checkbox to the right of the class style named “gray_text.” The text changes to the style attributes assigned to the gray_text class style.
- With the cell still selected, choose the Cell tab of the Table Inspector. Choose Top from the Vertical Alignment drop-down
menu.
You have completed the section of the lesson that pertains to layouts using tables. Read on to see how you can use Cascading Style Sheets for layout.
- Choose File > Save, and then File > Close.