Total members 11751 |It is currently Mon Oct 22, 2018 1:29 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





In this example we use CSS to set the different background colors for the table rows.
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Multi colored table rows</title>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
style type="text/css">
td {
   
color#FFFFCC;
}
table {
  
width:25%;
  
border-collapse:collapse;
}
table th{
   
background-color#0777E7;
}


tr.rowX td {
  
background-color#436789;
}
tr.rowY td {
  
background-color#790990;
}
</
style>
</
head>

<
body>
<
table>
 <
tr class="rowY"
    <
th>Header1</td>
    <
th>Header2</td>

    <
th>Header3</td>
  </
tr>
 
  <
tr class="rowX"
    <
td>Row1 Cell Text1</td>
    <
td>Row1 Cell Text2</td>
    <
td>Row1 Cell Text3</td>
  </
tr>
  <
tr class="rowY"
    <
td>Row2 Cell Text1</td>

    <
td>Row2 Cell Text2</td>
    <
td>Row2 Cell Text3</td>
  </
tr>
  <
tr class="rowX"
    <
td>Row3 Cell Text1</td>
    <
td>Row3 Cell Text2</td>
    <
td>Row3 Cell Text3</td>
  </
tr>
  <
tr class="rowY"
    <
td>Row4 Cell Text1</td>
    <
td>Row4 Cell Text2</td>
    <
td>Row4 Cell Text3</td>
  </
tr>
</
table>
</
body>
</
html>
 





Author:
Mastermind
User avatar Posts: 2707
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Multi colored table rows
 Table with colored background     -  
 Select odd rows from table     -  
 different colors for table Even- Odd rows and Cells     -  
 Listing All Rows and Fields in a Table     -  
 Multi Thread Program     -  
 Javascript Multi-dimensional Arrays     -  
 Toggle the Multi Monitor Setting in Windows XP     -  
 multi-frameset and non-re-sizable html frame pages     -  
 $2500 per month working with Multi-million dollar companies     -  
 three rows frameset .     -  



Topic Tags

HTML Table
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com