Google Make colorful html table with only CSS

Sep 25, 2010

Make colorful html table with only CSS

This is a little bit of messy,but the outcome is so sweet.Once you make ready a table ,you can reuse it again and again.

Colorful html table with only CSS

Why only CSS-html table and CSS

CSS style sheet is highly recommended.It helps to control,change things without messing up with codes.
Also one CSS style can be applied to any number of html element.
And more

html table

[Code]html

<table class="table-style"><tbody>
<tr>
<th class="table-color-ha">Diet</th>
<th class="table-color-h">Drinks</th>
<th class="table-color-h">Fruits</th>
<th class="table-color-h">Food</th>
</tr>
<tr>
<td class="table-color-m">Mon day</td>
<td class="table-color-ma">Coffee</td>
<td class="table-color-mb">Orange</td>
<td class="table-color-mc">sugar</td>
</tr>
<tr>
<td class="table-color-m">Sunday</td>
<td class="table-color-ma">Milk</td>
<td class="table-color-mb">Apple</td>
<td class="table-color-mc">Rice</td>
</tr>
<tr>
<td class="table-color-m">Friday</td>
<td class="table-color-ma">Tea</td>
<td class="table-color-mb">Grape</td>
<td class="table-color-mc">Flour</td>
</tr>
</tbody></table>
[Code]CSS
<style type="text/css">
.table-color-ha
{
background:#2A0A0A;
font-size:.9em;
color:white;
font-weight:bold;
text-align:center;
}
.table-color-h
{
background:#071907;
font-size:.9em;
color:white;
font-weight:bold;
text-align:center;
}
.table-color-m
{
border-left:1px groove #C9C299;
font-size:.8em;
font-weight:bold;
color:#181907;
text-align:left;
}

.table-color-ma
{
background:#810541;
font-size:.9em;
color:white;
font-weight:bold;
text-align:center;
}
.table-color-mb
{
background:#151B54;
font-size:.9em;
color:white;
font-weight:bold;
text-align:center;
}
.table-color-mc
{
background:#250517;
font-size:.9em;
color:white;
font-weight:bold;
text-align:center;
}

.table-style
{
margin:5px 5px 5px 5px;
}
.table-style th
{
padding:5px 5px 5px 5px;
}
.table-style tr
{
padding:5px 5px 5px 5px;
}
.table-style td
{
padding:5px 5px 5px 5px;
}
</style>

Diet Drinks Fruits Food
Mon day Coffee Orange sugar
Sunday Milk Apple Rice
Friday Tea Grape Flour



No comments:

Post a Comment