HTML Tables
Notes:
HTML - table tag | HTML - tr tag | HTML - th tag | HTML - td tag
How to create tables in html?
How to add rows to table?
How to add cells to table rows?
html table tag:
table tag is a paired tag.
border="in pixels"
cellspacing="in pixels"
cellpadding="in pixels"
bgcolor="color"
background="imagename"
width="pixels/percentage"
height="pixels/percentage"
html caption tag:
caption tag is paired tag.
Used to set title or caption to the table.
html tr tag:
used to create table rows.
tr tag has two child tags th for table heading cells, td for table data cells.
bgcolor="color"
align="left/center/right"
valign="top/middle/bottom"
html th tag:
th tag should be used in first tr.
not mandatory but need to follow some rules.
html td tag:
table data cell used to create cells.
bgcolor="color"
align="left/center/right"
valign="top/middle/bottom"
width="pixels"
height="pixels"
rowspan="number"
colspan="number"
Interview Questions:
1. Which HTML tag is used to add a row in a table?
a. td
b. dd
c. tr
d. th
Answer: c
2 .Which HTML tag is used to add a table data cell in a table row?
a. dt
b. td
c. th
d. dh
Answer: b
3. The space between the content and border around it in HTML table is specified by the HTML attribute:
a. cellspacing
b. margin
c. cellpadding
d. padding
Answer: c