Web Programming I - Week 2: Mikheil Rukhaia
Web Programming I - Week 2: Mikheil Rukhaia
Mikheil Rukhaia
September 3, 2018
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Outline
3 HTML Tables
4 Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 2 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 3 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Hyperlink
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 4 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Directories
I Terminology:
root directory is the main directory of web site.
subdirectory is within another directory.
parent directory is a directory having a subdirectory.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 5 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
URL
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 6 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
The scheme
Scheme Description
http:// Hyper Text Transfer Protocol
https:// Secure Hyper Text Transfer Protocol
ftp:// File Transfer Protocol
file:// Local machine or local network resource.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 7 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 8 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 9 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
I Absolute URL: a full URL, unique for each file on the Internet.
I Relative URLs work only within the same web site; they cannot
be used to link to pages on other servers.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 10 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Relative URL
I From the root: use the path, starting with slash, from the root
directory to the file.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 11 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
I Allows to specify a base URL for a page that all relative URLs
will be added to.
<base href="http://www.logic.at/staff/" />
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 12 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 13 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 14 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Terminology
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 15 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Destination anchor
I Common usage:
“Back to top” links at the bottom of long pages.
A list of contents.
Links to footnotes or definitions.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 16 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Attributes of <a>
Linking to e-mail
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 18 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 19 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
HTML Tables
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 20 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Introduction
I Every row must contain equal number of cells, even if they are
empty.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 21 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Basic elements
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 22 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Example
<table>
<tr>
<th> row 1, column 1 </th>
<th> row 1, column 2 </th>
<th> row 1, column 3 </th>
</tr>
<tr>
<td> row 2, column 1 </td>
<td> row 2, column 2 </td>
<td> row 2, column 3 </td>
</tr>
</table>
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 23 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Attributes of <table>
I All other attributes are styling ones and are deprecated, you
should use CSS instead.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 24 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 25 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
I Example: rule="all"
Value Description
none No inner borders (the default).
groups Displays inner borders between all table groups.
rows Displays horizontal borders between each row.
cols Displays vertical borders between each column.
all Displays all borders.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 26 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
I valign specifies the vertical alignment for all cells in the row
(top, middle (default), bottom or baseline)
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 27 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 28 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Splitting up tables
I Tables can be split into three parts: header, body and footer.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 29 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Example
<table>
<thead>
<tr> <th>A header</th> </tr>
</thead>
<tfoot>
<tr> <td>A footer</td> </tr>
</tfoot>
<tbody>
<tr> <td>A cell in a body </td> </tr>
</tbody>
<tbody>
<tr> <td>A cell in other body</td> </tr>
</tbody>
</table>
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 30 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Caption of a table
I Example
<table>
<caption> A caption of the table. </caption>
<tr> <td> The table data </td> <tr>
</table>
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 31 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
I Example
<table>
<caption> Spanning in table. </caption>
<tr> <td colspan="2"> r1c1-2 </td> </tr>
<tr>
<td rowspan="2"> r2-3c1 </td>
<td>r2c2</td>
</tr>
<tr> <td> r3c2 </td> </tr>
</table>
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 32 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Grouping columns
I Mostly they are used for formatting reasons, but they are not well
supported in recent browsers (use CSS instead).
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 33 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Example
<table>
<colgroup span="3">
<col span="2" />
<col span="1" />
</colgroup>
<tr>
<td> col1 </td>
<td> col2 </td>
<td> col3 </td>
</tr>
</table>
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 34 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Linearization of tables
I They start reading from the first row, reading all cells from left to
right.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 35 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Always put headings in the first row and/or the first column.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 36 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Laboratory Work
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 37 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Exercises
I Add some links to refer to other web pages using absolute and
relative URLs.
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 38 / 39
Uniform Resource Locator Links and Navigation HTML Tables Laboratory Work
Discussion?!
Web Programming I — Week 2 M. Rukhaia International Black Sea University September 3, 2018 39 / 39