Page 125 - CodePilot V5.0 C7
P. 125
</TR>
</TABLE>
</BODY>
</HTML>
USING THE BACKGROUND-COLOR AND COLOR PROPERTY
By default, the background colour of an HTML element is transparent. This means it has no
background colour, but you can set a colour using the BACKGROUND-COLOR property. You can
use the COLOR property to set the text colour.
USING THE BORDER-COLLAPSE AND BORDER-SPACING PROPERTY
Generally, table cells share a common border, but you can set the cells to have separate borders.
When cells are separated by borders using BORDER-COLLAPSE, the distance between adjacent
cells is determined by BORDER-SPACING. The BORDER-COLLAPSE property has a predefined
value of collapse, but you can set it to separate.
The following table summarises the CSS properties COLOR, BACKGROUND-COLOR,
BORDER-COLLAPSE and BORDER-SPACING that can be used to style the <TABLE> element:
Property Name Value Description
COLOR Colour Name, Hexadecimal This property specifies the text colour.
value or RGB value
BACKGROUND-COLOR Colour Name, Hexadecimal This property specifies the colour for
value or RGB value the background in a table on the web
page. You can apply colour to a cell,
row or the entire table.
BORDER-COLLAPSE collapse, separate It defines whether table borders should
be collapsed into one or separated.
BORDER-SPACING Length in pixels (px) This property specifies the space
between the borders of adjacent cells.
Code Write the HTML code to present the given web page using the BORDER-COLLAPSE
12 and BORDER-SPACING properties to control the borders and spacing.
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Parts of Speech</TITLE>
<STYLE>
TABLE {
BORDER-COLLAPSE: SEPARATE;
123
Lists and Tables in HTML5

