An example of displaying table parity rows in different colors is found on the Internet.

Source: Internet
Author: User
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> two-color table CSS instance </title>
<Style type = "text/CSS">
# Datagrid1 tr {
Background-color: expression (
This. sectionrowindex = 0? "# Ffcccc ":
(
(This. sectionrowindex % 2 = 0 )? "# Fff0f0": "# f0f0ff"
)
);
Color: expression (this. sectionrowindex = 0? "# Ffffff ":"");
Font-weight: expression (this. sectionrowindex = 0? "Bold ":"");
Tableselect: expression (
This. sectionrowindex = 0? "":
(
Onmouseover = function ()
{
This. style. backgroundcolor =
(
This. style. backgroundcolor! = "#69 cdff "? "#69 cdff ":
(
This. sectionrowindex = 0? "# Ffcccc ":
(
This. sectionrowindex % 2 = 0? "# Fff0f0": "# f0f0ff"
)
)
)
},
Onmouseout = function ()
{
This. style. backgroundcolor =
(
This. style. backgroundcolor! = "#69 cdff "? "#69 cdff ":
(
This. sectionrowindex = 0? "# Ffcccc ":
(
This. sectionrowindex % 2 = 0? "# Fff0f0": "# f0f0ff"
)
)
)
}
)
)
}
# Datagrid1 TD {
Background-color: expression (
This. cellindex = 0?
(
This. parentelement. sectionrowindex = 0? "# Ffcccc": "# dddddddd"
)
: NULL
)
}
. Findareatable1 {
Font-size: 12px;
Color: #333333;
Text-Decoration: none;
Width: 400px;
Cursor: hand;
Background-color: # ffffff;
Vertical-align: middle;
Text-align: center;
}
</Style>
</Head>
<Body>
<Table cellspacing = "1" class = "findareatable1" id = "datagrid1">
<Tr>
<TD> first row and first column </TD>
<TD> first line </TD>
<TD> first line </TD>
<TD> first line </TD>
<TD> first line </TD>
<TD> first line </TD>
</Tr>
<Tr>
<TD> first column of Row 1 </TD>
<TD> Row 1 </TD>
<TD> Row 1 </TD>
<TD> Row 1 </TD>
<TD> Row 1 </TD>
<TD> Row 1 </TD>
</Tr>
<Tr>
<TD> Row 2 first column </TD>
<TD> Row 2 </TD>
<TD> Row 2 </TD>
<TD> Row 2 </TD>
<TD> Row 2 </TD>
<TD> Row 2 </TD>
</Tr>
<Tr>
<TD> three first columns in the row </TD>
<TD> Row 3 </TD>
<TD> Row 3 </TD>
<TD> Row 3 </TD>
<TD> Row 3 </TD>
<TD> Row 3 </TD>
</Tr>
<Tr>
<TD> four first columns in the row </TD>
<TD> row 4 </TD>
<TD> row 4 </TD>
<TD> row 4 </TD>
<TD> row 4 </TD>
<TD> row 4 </TD>
</Tr>
<Tr>
<TD> the first five columns in the row </TD>
<TD> Row 5 </TD>
<TD> Row 5 </TD>
<TD> Row 5 </TD>
<TD> Row 5 </TD>
<TD> Row 5 </TD>
</Tr>
</Table>
</Body>
</Html>
In addition, I have seen several other simple methods before, and I will try to find them later.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.