Which CSS property changes the background color of a table?
Analysis & Theory
`background-color` is used to set the background color of the table or table cells.
How do you add a border to all table cells?
A
border: 1px solid black;
Analysis & Theory
`border: 1px solid black;` adds a solid black border to table cells.
Which property removes the default space between table cells?
C
border-collapse: collapse;
Analysis & Theory
`border-collapse: collapse;` removes space and merges adjacent borders into one.
What property is used to control spacing between table cells when borders are not collapsed?
Analysis & Theory
`border-spacing` controls the distance between cells when `border-collapse: separate;`.
Which property is used to control the overall layout of a table?
Analysis & Theory
`table-layout` defines how the table’s layout is calculated (e.g., `auto`, `fixed`).
What CSS property sets the horizontal alignment of text in a table cell?
Analysis & Theory
`text-align` controls horizontal alignment (left, center, right) of text in cells.
Which CSS property adds space inside table cells?
Analysis & Theory
`padding` adds space inside the border of a cell.
How do you alternate row colors in a table using CSS?
C
Use `nth-child(even/odd)` selectors
D
Use `row-alternate` attribute
Analysis & Theory
You can use `tr:nth-child(even)` and `tr:nth-child(odd)` to set alternating row colors.
Which display value makes an element behave like a table row?
Analysis & Theory
`display: table-row;` makes a block element behave like a table row.
How do you make a table span 100% of the container width?
Analysis & Theory
`width: 100%;` makes the table stretch to fill the entire width of its container.