Wednesday, January 19, 2011

How to design a table using CSS?

Example 1:

table.main {
border:5px solid;
border-color: blue;
}
td.column1 {
border: 1px solid;
border-color: black;
background-color:pink;
color: #0000EE;
padding: 24px 12px 24px 4px;
}
td.default {
border: 1px solid;
border-color: #000000;
padding: 24px 12px 24px 4px;
background-color: #FFFFFF;
color: #000000;
}
td.highlight {
border: 1px solid;
border-color: red;
padding: 24px 12px 24px 4px;
background-color: #FFFF00;
color: #000000;
}



Title Row 1

data, data, data...

data, data, data...

Title Row 2

data, data, data...

data, data, data...

Title Row 3

data, data, data...

data, data, data...


Example:2

<table>
<head>
<style type="text/css">
</head>
<body>
table, td, th
{
border:1px solid red;
}
th
{
background-color:pink;
color:white;
}
</style>
<table><tbody>
<tr> <th>RollNo</th> <th>Name</th> <th>Result</th> </tr>
<tr> <td>A1</td> <td>Agna</td> <td>Pass</td> </tr>
<tr> <td>A2</td> <td>Amutha</td> <td>Fail</td> </tr>
<tr> <td>A3</td> <td>Bavithra</td> <td>Pass</td> </tr>
<tr> <td>A4</td> <td>Cathy</td> <td>Pass</td> </tr>
</tbody></table>
</body>
</html>


RollNo Name Result
A1 Agna Pass
A2 Amutha Fail
A3 Bavithra Pass
A4 Cathy Pass

Example:3
Creating table using CSS and Div
html>
<head>
<title></title>
<style type="text/css">

.tablediv {
display: table;
width:600px;
background-color:lightgreen;
border:3px solid blue;
border-spacing:10px;
border-collapse:separate;
}

.celldiv {
float:left;
display: table-cell;
width:50%;
background-color:pink;
}

.rowdiv {
display: table-row;
width:auto;
background-color:yellow;
}

</style>
</head>

<body>
<div class="tablediv">
<div class="rowdiv">
<div class="celldiv">Flowers</div>
<div class="celldiv">Fruits</div>
</div>

<div class="rowdiv">
<div class="celldiv">Rose</div>
<div class="celldiv">Apple</div>
</div>

</div>
</body>
</html>



Flowers
Fruits

Rose
Apple

No comments:

Post a Comment

Send your Design, Code or any other Creations to qualitypointmail@gmail.com for showing them here. You can mention your contact details(email id, phone) also

If you are an Expert, you can give review comments or feedback to show your skills

This blog will help you to get more opportunities as this blog will be linked to our other blogs and sites which attract more visitors.

A Good Beginning Is Half Done

Start Freelancing