6 Tables Flashcards

1
Q

Create a table

A

&lttable> to define start and end of table
&lttr> to define table row
&ltth> for table heading
&lttd> for table data

&lttable>

&lttr>
&ltth>&lt/th>
&ltth scope="col">Saturday&lt/th>
&ltth scope="col">Sunday&lt/th>
&lt/tr>
&lttr>
&ltth scope="row">Tickets sold:&lt/th>
&lttd>120&lt/td>
&lttd>135&lt/td>
&lt/tr>
&lttr>
&ltth scope="row">Total sales:&lt/th>
&lttd>$600&lt/td>
&lttd>$675&lt/td>
&lt/tr>

&lt/table>

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

Make a table data or table heading span multiple columns

A

colspan=”2” (for 2 cells)

colspan=”1” (for 1 cell. Basically regular)

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

Make a table data or table heading span multiple rows

A

rowspan attribute

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

Semantic for table head, body and bottom

Why have these?

A

&ltthead> (for top headings)
&lttbody> ( for most of it)
&lttfoot> (for bottom, sum, etc.)

Why?
if the list is really long, you can have the head rand foot always visible as your scroll
to make tables more accessible by associating each header with all the data in the same row or column. Screenreaders are then able to read out a whole row or column of data at once, which is pretty useful.

&ltthead>
&lttr>
&ltth>Date&lt/th>
&ltth>Income&lt/th>
&ltth>Expenditure&lt/th>
&lt/tr>
&lt/thead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Control the width of a table cell

A

width attribute within a &lttd> tag

but just use CSS now

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

control cell spacing and padding of a table in html

A

cellpadding and cellspacing attributes within the main &lttable> tag
( but just use CSS now)

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

control border size and background colour of a table with html

A

border and bgcolor tags within the main &lttable> tag

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

Semantics for whether the table heading is for a row or column

A

scope=”col”

scope=”row”

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

Style only a column

A

below the table element, create a col group

&ltcolgroup>
&ltcol>
&ltcol style=”background-color: yellow”>
&lt/colgroup>

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

What will this do if there are 4 columns?
&ltcolgroup>
&ltcol>
&ltcol style=”background-color: yellow” span 2>
&ltcol>
&ltcol>
&lt/colgroup>

A

the second and third column will be yellow

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

Create a table caption (for sighted and sight impared)

A

&lttable>
&ltcaption>Dinosaurs in the Jurassic period&lt/caption>


&lt/table>

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

markup the exact

A

Set the headers attribute for each cell with the ids of it’s row and col headings

&ltthead>
  &lttr>
    &ltth id="purchase">Purchase&lt/th>
    &ltth id="location">Location&lt/th>
    &ltth id="date">Date&lt/th>
    &ltth id="evaluation">Evaluation&lt/th>
    &ltth id="cost">Cost (€)&lt/th>
  &lt/tr>
&lt/thead>
&lttbody>
&lttr>
  &ltth id="haircut">Haircut&lt/th>
  &lttd headers="location haircut">Hairdresser&lt/td>
  &lttd headers="date haircut">12/09&lt/td>
  &lttd headers="evaluation haircut">Great idea&lt/td>
  &lttd headers="cost haircut">30&lt/td>
&lt/tr>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Add a border to a column only

A
&lttable>
  &ltcolgroup>
    &ltcol span="2" style="background-color:red">
    &ltcol style="background-color:yellow">
  &lt/colgroup>
  &lttr>
    &ltth>ISBN&lt/th>
    &ltth>Title&lt/th>
    &ltth>Price&lt/th>
  &lt/tr>
  &lttr>
    &lttd>3476896&lt/td>
    &lttd>My first HTML&lt/td>
    &lttd>$53&lt/td>
  &lt/tr>
&lt/table> 

under the table element
border-collapse: collapse

Then under the col of colgroup
border etc.

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

What does border collapse (of a table) do?

A

The border-collapse property is used to specify the border model of a table. It specifies whether the borders of the table and its table cells should be “joined” or separated.

When borders are separate, the table and each of its table cells can have their own distinct borders, and there is space between them. You can control the amount of space between borders of adjacent table cells using the border-spacing property.

When borders are “collapsed”, adjacent table cells share borders, and the cells at the edges of the table share their borders with the borders of the table itself.

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