Tables Flashcards

1
Q

What is the primary use of HTML tables?

A

HTML tables are used for tabular data, consisting of rows and columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When should you use a <table> element?

A

Use a <table> for data that needs to be compared, sorted, or cross-referenced.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the main elements inside a <table> in order?

A

The main elements are: <caption>, <colgroup>, <thead>, <tbody>, <tfoot>, and <tr>.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the <caption> element define in a table?

A

The <caption> element defines the table’s title and is the first element inside a <table>.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the three sections that a table can have?

A

A table can have up to three sections: <thead>, <tbody>, and <tfoot>.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the table cells in HTML?

A

Table cells are defined by <th> (header cell) and <td> (data cell).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you define a table row and what can it contain?

A

A table row is defined by <tr>, which contains either header cells (<th>) or data cells (<td>).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What attributes are used to merge cells horizontally and vertically in a table?

A

The colspan attribute merges cells horizontally (across columns) and rowspan merges cells vertically (across rows).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the role of the <colgroup> element in HTML tables?

A

The <colgroup> element defines groups of columns for styling purposes, typically used with the <col> element for limited column styling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of the scope attribute in table headers?

A

The scope attribute defines the relationship between a header and the cells it applies to, such as scope="col" for column headers or scope="row" for row headers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the correct order of elements inside a <table> tag?

A

The correct order is: <caption>, <thead>, <tbody>, <tfoot>, and then rows <tr> with cells <th> or <td>.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you style specific columns in a table?

A

Use <colgroup> and <col> to group and style columns in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly