Tables are very useful on a web browser because they provide a flexible and attractive way of presenting data.
A table is a set of rows and columns, and a cell is the intersection of a row and a column.
Before designing tables in HTML, it’s important to understand the concept of a table with the help of an example.
The <table> tag is used to define a table in HTML and each row is represented by the <tr> tag, while each data cell within a row is represented by <td> tag.
The colspan attribute in HTML indicates the number of columns a cell should span.
Choose True or False for the following statements.
Forms in HTML are used solely for displaying information on a web page. False
The <form> tag is used to define a form in HTML. True
Radio buttons are used to select multiple options simultaneously. False
The value attribute in the <input> tag specifies the initial values to be assigned to the input element. True
Time to Perform
A Fill in the blanks.
Columns are the vertical lines of data.
Tables are defined with the <table> tag.
The letters TR stands for ‘table row‘, while TD stands for ‘table data‘.
The bordercolor attribute is used to set the colour of a table’s border.
Align attribute can appear inside <table>, <tr> or <td> tags.
B State whether the following statements are true or false.
By default, space is left for borders. True
The larger the value the thicker will be the border. True
We cannot assign different background to a row, column or a cell. False
The <input> tag allows the user to enter information in a table. True
Checkboxes are used to select one or more options. True
C Name the following.
Number of cells in a table with 5 rows and 16 columns. 80 cells
Optional description of the table. caption
Attribute that sets the spacing between the border and the contents of the cell. cellpadding
Attribute to set the background colour of a row or column. bgcolor
Attribute to set the vertical alignment of data in a column. valign
Extra Questions.
Values of horizontal align attribute are left, center and right.
Values of vertical alignment are top, middle and bottom.
Cellspacing attribute specifies the spacing inserted between individual cells in a table.
By default, a browser uses a cellpadding of 1.
The rowspan attribute specifies the number of rows the text should cover to occupy.
Forms are used to accept input from the user.
The maxlength attribute specifies the maximum number of characters that can be entered in an input field.
In a password field, the data entered does not get displayed.
The two pre-defined buttons in HTML are Submit and Reset.
On clicking the Submit button, the data in all the fields is sent to a server.
The Reset button clears all the content and sets the default values for all the form elements.
The <textarea> tag is a multi-line input control. Row defines the height of the text area. Cols defines the width of the text area.