Hello and welcome to the third in a series of beginner level classes for web developers.
In the previous lesson (see here), we learned about the paragraph and list tags.
At this point the code in your my_site.html file should look like this:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2>NASA | JPL</h2>
<h1>ON A MISSION</h1>
<h4>PODCAST</h4>
<p>A new podcast from NASA</p>
<ul>
<li>Arrival</li>
<li>We Are the World</li>
<li>Worlds of Wonder</li>
</ul>
<ol>
<li>NASA is cool</li>
<li>Coding comes second, arguably.</li>
<li>What is third place?!</li>
</ol>
</body>
</html>
This lesson introduces tables. Tables offer a way for you (as a web developer) to arrange items in rows and columns.
For example, consider the following data arranged in table format (rows and columns);
The table above has three rows (horizontal entries) and two columns (vertical entries).
The first row provides the headings of the table, in this case, Name and Title.
The next two rows consist of actual data (information) about two individuals, John and Jane.
<table>
<tr> <th >Name</th> <th >Title</th> </tr>
<tr> <td >John Doe</td> <td >Tutor</td> </tr>
<tr> <td >Jane Doe</td> <td >Student</td> </tr>
</table>
Again, a table starts with an opening table tag i.e. <table> and is closed at the end with a closing table tag </table>.
We have three rows here, each row starts with a opening row tag <tr> and ends with a closing row tag </tr>.
Inside each row, is where we specify the data (or column value) using the opening table data tag <td> and the closing table data tag </td>.
If the data is a heading, instead of <td></td> tags, <th> and </th> tags are used.
Have fun!
As always, here is a video you can use to follow up and if you have any questions/comments, leave them in the comment section below.
In the previous lesson (see here), we learned about the paragraph and list tags.
At this point the code in your my_site.html file should look like this:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2>NASA | JPL</h2>
<h1>ON A MISSION</h1>
<h4>PODCAST</h4>
<p>A new podcast from NASA</p>
<ul>
<li>Arrival</li>
<li>We Are the World</li>
<li>Worlds of Wonder</li>
</ul>
<ol>
<li>NASA is cool</li>
<li>Coding comes second, arguably.</li>
<li>What is third place?!</li>
</ol>
</body>
</html>
This lesson introduces tables. Tables offer a way for you (as a web developer) to arrange items in rows and columns.
For example, consider the following data arranged in table format (rows and columns);
Name | Title |
---|---|
John Doe | Tutor |
Jane Doe | Student |
The table above has three rows (horizontal entries) and two columns (vertical entries).
The first row provides the headings of the table, in this case, Name and Title.
The next two rows consist of actual data (information) about two individuals, John and Jane.
- In html, data can be displayed in table form using the table tag.
- The table tag opens with a <table> and closes with a </table>.
- Inside the table, rows are specified using <tr> (opening) and </tr> (closing) tags, where tr stands for table row.
- Inside each row, columns are specified using <td> (opening) and </td> (closing) tags, where td stands for table data.
- However, to specify a heading for your table, the tags <th> (opening) and </th> (closing) are used, where th stands for table heading.
<table>
<tr> <th >Name</th> <th >Title</th> </tr>
<tr> <td >John Doe</td> <td >Tutor</td> </tr>
<tr> <td >Jane Doe</td> <td >Student</td> </tr>
</table>
Again, a table starts with an opening table tag i.e. <table> and is closed at the end with a closing table tag </table>.
We have three rows here, each row starts with a opening row tag <tr> and ends with a closing row tag </tr>.
Inside each row, is where we specify the data (or column value) using the opening table data tag <td> and the closing table data tag </td>.
If the data is a heading, instead of <td></td> tags, <th> and </th> tags are used.
- Save the file and then open it in your browser. Notice how the table is displayed.
- Note that no borders will be shown on your table (Adding borders is a topic for another day).
- For now, as an exercise, try displaying the following table (ignore the borders).
Name | Title | Age |
---|---|---|
John Doe | Tutor | 27 |
Jane Doe | Student | 22 |
Have fun!
As always, here is a video you can use to follow up and if you have any questions/comments, leave them in the comment section below.
Comments
Post a Comment