Styling table columns : table « Tags « HTML / CSS

HTML / CSS » Tags » table 
Styling table columns
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>Styling table columns</title>
<meta http-equiv="content-type"
    content="text/html; charset=utf-8" />
<style>

.datatable {
  border: 1px solid #D6DDE6;
  border-collapse: collapse;
  width: 80%;
}
.datatable td {
  border:2px solid #ffffff;
  padding: 0.3em;
}
.datatable th {
  border:2px solid #ffffff;
  background-color: #00487D;
    color: #FFFFFF;
  font-weight: bold;
  text-align: left;
  padding: 0.3em;
}
.datatable colgroup.odd {
  background-color: #80C9FF;
  color: #000000;
}

.datatable colgroup.even {
  background-color: #BFE4FF;
  color: #000000;
}
    </style>
</head>
<body>

<table class="datatable">

  <colgroup class="odd">
    <col />
    <col />
  </colgroup>
  <colgroup class="even">
    <col />
    <col />
  </colgroup>

  <tr>
    <th>Pool A</th>
    <th>Pool B</th>
    <th>Pool C</th>
    <th>Pool D</th>
  </tr>
  <tr>
    <td>Title</td>
    <td>Title</td>
    <td>New Zealand</td>
    <td>Title</td>
  </tr>
  <tr class="even">
    <td>South Africa</td>
    <td>Wales</td>
    <td>Scotland</td>
    <td>Ireland</td>
  </tr>
  <tr>
    <td>Samoa</td>
    <td>Fiji</td>
    <td>Italy</td>
    <td>Argentina</td>
  </tr>
  <tr class="even">
    <td>USA</td>
    <td>Canada</td>
    <td>Romania</td>
    <td>Europe 3</td>
  </tr>
  <tr>
    <td>Repechage 2</td>
    <td>Asia</td>
    <td>Repechage 1</td>
    <td>Namibia</td>
  </tr>
</table>

</body>
</html>

   
    
    
    
  
Related examples in the same category
1.'table' Example
2.Nested tables
3.How tables linearize
4.A basic table
5.'col' Example
6.'summary' specifies a brief description of a table
7.basic table
8.Basic table with tr, td
9.A simple XHTML table
10.table tag opens a table
11.Table inline style
12.Calendar table
13.Fixed table first column
14.Make table font bold
15.table font-family: arial, verdana, sans-serif;
16.Table style
17.table color: white;
18.Table layout
19.Table styling
20.Table with shading colors
21.HTML markup for a simple table (continued)
22.providing table alignment and spacing
23.A table with spanned rows and columns
24.Img in a table cell
25.Table with summary
26.Using th for table heading
27.Dividing a table into head, body and footer.
28.A Basic Table with Caption
29.Using the table header attribute
30.table line-height: 1.3em;
31.table padding: 0;
32.table color: #fff;
33.table table-layout: fixed;
34.table caption-side: bottom;
35.HTML markup for a simple table
36.Vertical alignment in table cells
37.A Basic Table 2
38.Adding Text Alignmnet for table
39.Stripe the table
40.Nested css table
41.Structural Table
42.CSS Table Rowspan Demo
43.Spreadsheet data
44.Fixed Table
45.Shrinkwrapped Table
46.All table content is enclosed within the tbody
47.Style for table body
48.Horizontal Stretched Table
49.Using the th element for table headings
50.Table heads, bodies and footers
51.An Accessible Table
52.Selecting cells in body
53.Selecting all tables and cells
54.Selecting all cells
55.'align' specifies the horizontal alignment of the 'table' and 'iframe'
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.