What is the purpose of the `<colgroup>` tag in an HTML table?
A
To define a table header
B
To group columns for styling
Analysis & Theory
`<colgroup>` is used to group columns together so styles can be applied to them collectively.
Which tag must be used inside `<colgroup>` to define individual columns?
Analysis & Theory
`<col>` is used within `<colgroup>` to define the properties of individual columns.
Where should the `<colgroup>` tag appear in a table?
C
Immediately after the opening `<table>` tag
D
Before the closing `</table>` tag
Analysis & Theory
`<colgroup>` should appear right after the opening `<table>` tag and before any row definitions.
Which attribute is commonly used in `<col>` to apply a style?
Analysis & Theory
`style` is used to directly apply CSS styles to a column via the `<col>` tag.
What does `<col span='2'>` mean?
A
Defines two columns with the same style
C
Creates a two-row header
Analysis & Theory
`span='2'` means the styling applies to two columns instead of just one.
Can you apply background color to a column using `<col>`?
B
Yes, using inline CSS or class
Analysis & Theory
Yes, background color can be applied to entire columns via the `<col>` tag.
What happens if `<colgroup>` has fewer `<col>` elements than the number of table columns?
B
Remaining columns are styled normally
C
Only defined columns are styled; others remain default
D
All columns get the last style
Analysis & Theory
Only the defined columns will receive the style. Others are unaffected.
Is it valid to use both `<colgroup>` and CSS classes to style columns?
A
No, only one can be used
B
Yes, and they can work together
Analysis & Theory
Yes, `<colgroup>` can be combined with CSS classes or inline styles for column styling.
Which of the following correctly defines a column with red background?
A
<col style='background: red;'>
B
<td style='background: red;'>
C
<column style='color: red;'>
Analysis & Theory
`<col style='background: red;'>` applies a red background to the entire column.
What is the default behavior of `<colgroup>` if no style or class is applied?
D
It aligns text to center
Analysis & Theory
If no styles or classes are applied, `<colgroup>` does nothing by default.